sharp-chat/SharpChat/Packet/MessageBroadcastPacket.cs

22 lines
612 B
C#

using System;
namespace SharpChat.Packet {
public class MessageBroadcastPacket : ServerPacket {
private readonly long Timestamp;
private readonly string Body;
public MessageBroadcastPacket(string body) {
Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
Body = body;
}
public override string Pack() {
return string.Format(
"2\t{0}\t-1\t0\fsay\f{1}\t{2}\t10010",
Timestamp,
SockChatUtility.SanitiseMessageBody(Body),
SequenceId
);
}
}
}