30 lines
870 B
C#
30 lines
870 B
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace SharpChat.Packet {
|
|
public class BanListResponsePacket : ServerPacket {
|
|
private readonly long Timestamp;
|
|
private readonly string[] Bans;
|
|
|
|
public BanListResponsePacket(string[] bans) {
|
|
Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
|
|
Bans = bans;
|
|
}
|
|
|
|
public override string Pack() {
|
|
StringBuilder sb = new();
|
|
|
|
sb.AppendFormat("2\t{0}\t-1\t0\fbanlist\f", Timestamp);
|
|
|
|
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", SequenceId);
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|