31 lines
1 KiB
C#
31 lines
1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace SharpChat.Packet {
|
|
public class AuthSuccessPacket : ServerPacket {
|
|
public ChatUser User { get; private set; }
|
|
public ChatChannel Channel { get; private set; }
|
|
public ChatUserSession Session { get; private set; }
|
|
|
|
public AuthSuccessPacket(ChatUser user, ChatChannel channel, ChatUserSession sess) {
|
|
User = user ?? throw new ArgumentNullException(nameof(user));
|
|
Channel = channel ?? throw new ArgumentNullException(nameof(channel));
|
|
Session = sess ?? throw new ArgumentNullException(nameof(channel));
|
|
}
|
|
|
|
public override IEnumerable<string> Pack() {
|
|
StringBuilder sb = new();
|
|
|
|
sb.Append('1');
|
|
sb.Append("\ty\t");
|
|
sb.Append(User.Pack());
|
|
sb.Append('\t');
|
|
sb.Append(Channel.Name);
|
|
sb.Append('\t');
|
|
sb.Append(SockChatServer.MSG_LENGTH_MAX);
|
|
|
|
return new[] { sb.ToString() };
|
|
}
|
|
}
|
|
}
|