28 lines
1 KiB
C#
28 lines
1 KiB
C#
using System;
|
|
|
|
namespace SharpChat.Packet {
|
|
public class UserChannelJoinPacket : ServerPacket {
|
|
public ChatUser User { get; private set; }
|
|
|
|
public UserChannelJoinPacket(ChatUser user) {
|
|
User = user ?? throw new ArgumentNullException(nameof(user));
|
|
}
|
|
|
|
public override string Pack() {
|
|
return string.Format(
|
|
"5\t0\t{0}\t{1}\t{2}\t{3} {4} {5} {6} {7}\t{8}",
|
|
User.UserId,
|
|
User.LegacyNameWithStatus,
|
|
User.Colour,
|
|
User.Rank,
|
|
User.Can(ChatUserPermissions.KickUser) ? 1 : 0,
|
|
User.Can(ChatUserPermissions.ViewLogs) ? 1 : 0,
|
|
User.Can(ChatUserPermissions.SetOwnNickname) ? 1 : 0,
|
|
User.Can(ChatUserPermissions.CreateChannel | ChatUserPermissions.SetChannelPermanent, true) ? 2 : (
|
|
User.Can(ChatUserPermissions.CreateChannel) ? 1 : 0
|
|
),
|
|
SequenceId
|
|
);
|
|
}
|
|
}
|
|
}
|