sharp-chat/SharpChat.SockChat/PacketsS2C/BanListResponseS2CPacket.cs

27 lines
799 B
C#

using System.Text;
namespace SharpChat.SockChat.PacketsS2C {
public class BanListResponseS2CPacket : SockChatTimedS2CPacket {
private readonly string[] Bans;
public BanListResponseS2CPacket(string[] bans) {
Bans = bans;
}
public override string Pack() {
StringBuilder sb = new();
sb.AppendFormat("2\t{0}\t-1\t0\fbanlist\f", TimeStamp.ToUnixTimeSeconds());
foreach(string ban in Bans)
sb.AppendFormat(@"<a href=""javascript:void(0);"" onclick=""Chat.SendMessageWrapper('/unban '+ this.innerHTML);"">{0}</a>, ", ban);
if(Bans.Length > 0)
sb.Length -= 2;
sb.AppendFormat("\t{0}\t10010", MessageId);
return sb.ToString();
}
}
}