2022-08-30 15:00:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat.Packet {
|
|
|
|
|
public class UserUpdatePacket : ServerPacket {
|
2024-05-10 18:29:48 +00:00
|
|
|
|
private readonly long UserId;
|
|
|
|
|
private readonly string UserName;
|
|
|
|
|
private readonly ChatColour UserColour;
|
|
|
|
|
private readonly int UserRank;
|
|
|
|
|
private readonly ChatUserPermissions UserPerms;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-10 18:29:48 +00:00
|
|
|
|
public UserUpdatePacket(
|
|
|
|
|
long userId,
|
|
|
|
|
string userName,
|
|
|
|
|
ChatColour userColour,
|
|
|
|
|
int userRank,
|
|
|
|
|
ChatUserPermissions userPerms
|
|
|
|
|
) {
|
|
|
|
|
UserId = userId;
|
2024-05-19 01:53:14 +00:00
|
|
|
|
UserName = userName;
|
2024-05-10 18:29:48 +00:00
|
|
|
|
UserColour = userColour;
|
|
|
|
|
UserRank = userRank;
|
|
|
|
|
UserPerms = userPerms;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:24:43 +00:00
|
|
|
|
public override string Pack() {
|
2024-05-10 17:28:52 +00:00
|
|
|
|
return string.Format(
|
|
|
|
|
"10\t{0}\t{1}\t{2}\t{3} {4} {5} {6} {7}",
|
2024-05-10 18:29:48 +00:00
|
|
|
|
UserId,
|
|
|
|
|
UserName,
|
|
|
|
|
UserColour,
|
|
|
|
|
UserRank,
|
|
|
|
|
UserPerms.HasFlag(ChatUserPermissions.KickUser) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(ChatUserPermissions.ViewLogs) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(ChatUserPermissions.SetOwnNickname) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(ChatUserPermissions.CreateChannel) ? (
|
|
|
|
|
UserPerms.HasFlag(ChatUserPermissions.SetChannelPermanent) ? 2 : 1
|
|
|
|
|
) : 0
|
2024-05-10 17:28:52 +00:00
|
|
|
|
);
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|