sharp-chat/SharpChat/Packet/ChannelUpdatePacket.cs

30 lines
1.1 KiB
C#

namespace SharpChat.Packet {
public class ChannelUpdatePacket : ServerPacket {
private readonly string ChannelNamePrevious;
private readonly string ChannelNameNew;
private readonly bool ChannelHasPassword;
private readonly bool ChannelIsTemporary;
public ChannelUpdatePacket(
string channelNamePrevious,
string channelNameNew,
bool channelHasPassword,
bool channelIsTemporary
) {
ChannelNamePrevious = channelNamePrevious;
ChannelNameNew = channelNameNew;
ChannelHasPassword = channelHasPassword;
ChannelIsTemporary = channelIsTemporary;
}
public override string Pack() {
return string.Format(
"4\t1\t{0}\t{1}\t{2}\t{3}",
SockChatUtility.SanitiseChannelName(ChannelNamePrevious),
SockChatUtility.SanitiseChannelName(ChannelNameNew),
ChannelHasPassword ? 1 : 0,
ChannelIsTemporary ? 1 : 0
);
}
}
}