2024-05-20 02:16:38 +00:00
|
|
|
|
using System.Text;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
|
|
|
|
namespace SharpChat.Packet {
|
2024-05-20 02:16:38 +00:00
|
|
|
|
public class BanListResponsePacket : SockChatTimedS2CPacket {
|
2024-05-10 18:29:48 +00:00
|
|
|
|
private readonly string[] Bans;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-14 22:17:25 +00:00
|
|
|
|
public BanListResponsePacket(string[] bans) {
|
|
|
|
|
Bans = bans;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:24:43 +00:00
|
|
|
|
public override string Pack() {
|
2023-02-07 15:01:56 +00:00
|
|
|
|
StringBuilder sb = new();
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-20 02:16:38 +00:00
|
|
|
|
sb.AppendFormat("2\t{0}\t-1\t0\fbanlist\f", TimeStamp.ToUnixTimeSeconds());
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-10 18:29:48 +00:00
|
|
|
|
foreach(string ban in Bans)
|
|
|
|
|
sb.AppendFormat(@"<a href=""javascript:void(0);"" onclick=""Chat.SendMessageWrapper('/unban '+ this.innerHTML);"">{0}</a>, ", ban);
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-14 22:17:25 +00:00
|
|
|
|
if(Bans.Length > 0)
|
2022-08-30 15:00:58 +00:00
|
|
|
|
sb.Length -= 2;
|
|
|
|
|
|
2024-05-20 02:16:38 +00:00
|
|
|
|
sb.AppendFormat("\t{0}\t10010", MessageId);
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-10 15:24:43 +00:00
|
|
|
|
return sb.ToString();
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|