sharp-chat/SharpChat.Protocol.SockChat/PacketHandlers/PacketHandlerContext.cs

23 lines
760 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Sessions;
using SharpChat.Users;
using System;
using System.Collections.Generic;
namespace SharpChat.Protocol.SockChat.PacketHandlers {
public class PacketHandlerContext {
public IEnumerable<string> Args { get; }
public SockChatConnection Connection { get; }
public ISession Session => Connection.Session;
public ILocalUser User => Session.User;
public bool HasSession => Session != null;
public bool HasUser => HasSession;
public PacketHandlerContext(IEnumerable<string> args, SockChatConnection conn) {
Args = args ?? throw new ArgumentNullException(nameof(args));
Connection = conn ?? throw new ArgumentNullException(nameof(conn));
}
}
}