diff --git a/SharpChat/ChatContext.cs b/SharpChat/ChatContext.cs index e4b3471..23cf72f 100644 --- a/SharpChat/ChatContext.cs +++ b/SharpChat/ChatContext.cs @@ -200,7 +200,7 @@ namespace SharpChat { HandleDisconnect(user, reason); } - public void HandleChannelEventLog(string channelName, Action handler) { + public void HandleChannelEventLog(string channelName, Action handler) { foreach(StoredEventInfo msg in Events.GetChannelEventLog(channelName)) handler(msg.Type switch { "msg:add" => new MessageAddLogPacket( @@ -369,26 +369,26 @@ namespace SharpChat { RemoveChannel(oldChan); } - public void Send(IServerPacket packet) { + public void Send(ServerPacket packet) { foreach(ConnectionInfo conn in Connections) if(conn.IsAuthed) conn.Send(packet); } - public void SendTo(UserInfo user, IServerPacket packet) { + public void SendTo(UserInfo user, ServerPacket packet) { foreach(ConnectionInfo conn in Connections) if(conn.IsAuthed && conn.User!.UserId == user.UserId) conn.Send(packet); } - public void SendTo(ChannelInfo channel, IServerPacket packet) { + public void SendTo(ChannelInfo channel, ServerPacket packet) { long[] userIds = ChannelsUsers.GetChannelUserIds(channel); foreach(ConnectionInfo conn in Connections) if(conn.IsAuthed && userIds.Contains(conn.User!.UserId)) conn.Send(packet); } - public void SendToUserChannels(UserInfo user, IServerPacket packet) { + public void SendToUserChannels(UserInfo user, ServerPacket packet) { ChannelInfo[] chans = GetUserChannels(user); foreach(ChannelInfo chan in chans) SendTo(chan, packet); diff --git a/SharpChat/ConnectionInfo.cs b/SharpChat/ConnectionInfo.cs index 5dbcee6..c308c29 100644 --- a/SharpChat/ConnectionInfo.cs +++ b/SharpChat/ConnectionInfo.cs @@ -44,7 +44,7 @@ namespace SharpChat { RemotePort = (ushort)sock.ConnectionInfo.ClientPort; } - public void Send(IServerPacket packet) { + public void Send(ServerPacket packet) { if(!Socket.IsAvailable) return; diff --git a/SharpChat/IServerPacket.cs b/SharpChat/IServerPacket.cs index 7b6518d..7265fe9 100644 --- a/SharpChat/IServerPacket.cs +++ b/SharpChat/IServerPacket.cs @@ -1,10 +1,5 @@ namespace SharpChat { - public interface IServerPacket { - long SequenceId { get; } - string Pack(); - } - - public abstract class ServerPacket : IServerPacket { + public abstract class ServerPacket { public long SequenceId { get; } public ServerPacket(long sequenceId = 0) {