36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
|
using System;
|
|||
|
|
|||
|
namespace SharpChat.Packet {
|
|||
|
public class UserDisconnectLogPacket : ServerPacket {
|
|||
|
private readonly long Timestamp;
|
|||
|
private readonly string UserName;
|
|||
|
private readonly ChatUserDisconnectReason Reason;
|
|||
|
|
|||
|
public UserDisconnectLogPacket(
|
|||
|
DateTimeOffset timestamp,
|
|||
|
string userName,
|
|||
|
ChatUserDisconnectReason 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 {
|
|||
|
ChatUserDisconnectReason.Leave => "leave",
|
|||
|
ChatUserDisconnectReason.TimeOut => "timeout",
|
|||
|
ChatUserDisconnectReason.Kicked => "kick",
|
|||
|
ChatUserDisconnectReason.Flood => "flood",
|
|||
|
_ => "leave",
|
|||
|
},
|
|||
|
UserName,
|
|||
|
SequenceId
|
|||
|
);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|