Fixed connection error when issuing a permanent ban.
This commit is contained in:
parent
903e39ab76
commit
dc4989a3cf
1 changed files with 4 additions and 3 deletions
|
@ -189,9 +189,10 @@ namespace SharpChat
|
|||
}
|
||||
|
||||
public void BanUser(ChatUser user, TimeSpan duration, UserDisconnectReason reason = UserDisconnectReason.Kicked) {
|
||||
if(duration > TimeSpan.Zero)
|
||||
SendTo(user, new ForceDisconnectPacket(ForceDisconnectReason.Banned, DateTimeOffset.Now + duration));
|
||||
else
|
||||
if (duration > TimeSpan.Zero) {
|
||||
DateTimeOffset expires = duration >= TimeSpan.MaxValue ? DateTimeOffset.MaxValue : DateTimeOffset.Now + duration;
|
||||
SendTo(user, new ForceDisconnectPacket(ForceDisconnectReason.Banned, expires));
|
||||
} else
|
||||
SendTo(user, new ForceDisconnectPacket(ForceDisconnectReason.Kicked));
|
||||
|
||||
foreach(ChatConnection conn in Connections)
|
||||
|
|
Loading…
Reference in a new issue