diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-08 13:57:25 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-08 13:57:25 +0800 |
commit | 6fdea28236771ee1d90a6fc959075c79939ad566 (patch) | |
tree | 0fd3e2f013729468b11d06d09283a92b98ae4358 /cmd_nick.go | |
parent | tags.go: Remove erroneous MIT SPDX-License-Identifier (diff) | |
download | meseircd-6fdea28236771ee1d90a6fc959075c79939ad566.tar.gz meseircd-6fdea28236771ee1d90a6fc959075c79939ad566.tar.zst meseircd-6fdea28236771ee1d90a6fc959075c79939ad566.zip |
CAP: Primitive negotiation
Diffstat (limited to 'cmd_nick.go')
-rw-r--r-- | cmd_nick.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd_nick.go b/cmd_nick.go index 9ac3cd8..f24a7fd 100644 --- a/cmd_nick.go +++ b/cmd_nick.go @@ -22,7 +22,7 @@ func handleClientNick(msg RMsg, client *Client) error { } } } else { - if !nickToClient.CompareAndDelete(client.Nick, client) { + if (client.State >= ClientStateRegistered || client.Nick != "*") && !nickToClient.CompareAndDelete(client.Nick, client) { slog.Error("nick inconsistent", "nick", client.Nick, "client", client) return fmt.Errorf("%w: %v", ErrInconsistentClient, client) } @@ -34,7 +34,7 @@ func handleClientNick(msg RMsg, client *Client) error { } client.Nick = msg.Params[0] } - if client.State == ClientStatePreRegistration { + if client.State < ClientStateRegistered { err := client.checkRegistration() if err != nil { return err |