diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-08 15:17:50 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-08 15:17:50 +0800 |
commit | 9e1c9c5f43e2f0cf2dd1fa29b1ba3512dbbaeb7e (patch) | |
tree | c176990b7e54b292b70dcfe1f3bed5fa1ab630a3 /clients.go | |
parent | commandHandlers -> CommandHandlers (diff) | |
download | meseircd-9e1c9c5f43e2f0cf2dd1fa29b1ba3512dbbaeb7e.tar.gz meseircd-9e1c9c5f43e2f0cf2dd1fa29b1ba3512dbbaeb7e.tar.zst meseircd-9e1c9c5f43e2f0cf2dd1fa29b1ba3512dbbaeb7e.zip |
Implement SASL stub
Diffstat (limited to 'clients.go')
-rw-r--r-- | clients.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -16,6 +16,7 @@ type Client struct { Gecos string Host string Caps map[string]struct{} + Extra map[string]any Server Server State ClientState } @@ -55,8 +56,10 @@ func (client *Client) Teardown() { if !uidToClient.CompareAndDelete(client.UID, client) { slog.Error("uid inconsistent", "uid", client.UID, "client", client) } - if !nickToClient.CompareAndDelete(client.Nick, client) { - slog.Error("nick inconsistent", "nick", client.Nick, "client", client) + if (client.State >= ClientStateRegistered || client.Nick != "*") { + if !nickToClient.CompareAndDelete(client.Nick, client) { + slog.Error("nick inconsistent", "nick", client.Nick, "client", client) + } } } @@ -67,6 +70,7 @@ func NewLocalClient(conn *net.Conn) (*Client, error) { State: ClientStatePreRegistration, Nick: "*", Caps: make(map[string]struct{}), + Extra: make(map[string]any), } for range 10 { uid_ := []byte(self.SID) |