2024-05-10 15:07:56 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat.Packet {
|
|
|
|
|
public class UserUpdateNotificationPacket : ServerPacket {
|
|
|
|
|
public string PreviousName { get; private set; }
|
|
|
|
|
public string NewName { get; private set; }
|
|
|
|
|
public DateTimeOffset Timestamp { get; }
|
|
|
|
|
|
|
|
|
|
public UserUpdateNotificationPacket(string previousName, string newName) {
|
|
|
|
|
PreviousName = previousName ?? throw new ArgumentNullException(nameof(previousName));
|
|
|
|
|
NewName = newName ?? throw new ArgumentNullException(nameof(newName));
|
|
|
|
|
Timestamp = DateTimeOffset.Now;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:24:43 +00:00
|
|
|
|
public override string Pack() {
|
2024-05-10 17:28:52 +00:00
|
|
|
|
return string.Format(
|
|
|
|
|
"2\t{0}\t-1\t0\fnick\f{1}\f{2}\t{3}\t10010",
|
|
|
|
|
Timestamp.ToUnixTimeSeconds(),
|
|
|
|
|
PreviousName,
|
|
|
|
|
NewName,
|
|
|
|
|
SequenceId
|
|
|
|
|
);
|
2024-05-10 15:07:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|