35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace SharpChat.Packet {
|
|
public class UserDisconnectLogPacket : ServerPacket {
|
|
private readonly long Timestamp;
|
|
private readonly string UserName;
|
|
private readonly UserDisconnectReason Reason;
|
|
|
|
public UserDisconnectLogPacket(
|
|
DateTimeOffset timestamp,
|
|
string userName,
|
|
UserDisconnectReason reason
|
|
) {
|
|
Timestamp = timestamp.ToUnixTimeSeconds();
|
|
UserName = userName;
|
|
Reason = reason;
|
|
}
|
|
|
|
public override string Pack() {
|
|
return string.Format(
|
|
"7\t1\t{0}\t-1\tChatBot\tinherit\t\t0\f{1}\f{2}\t{3}\t0\t10010",
|
|
Timestamp,
|
|
Reason switch {
|
|
UserDisconnectReason.Leave => "leave",
|
|
UserDisconnectReason.TimeOut => "timeout",
|
|
UserDisconnectReason.Kicked => "kick",
|
|
UserDisconnectReason.Flood => "flood",
|
|
_ => "leave",
|
|
},
|
|
UserName,
|
|
SequenceId
|
|
);
|
|
}
|
|
}
|
|
}
|