From 9e1c9c5f43e2f0cf2dd1fa29b1ba3512dbbaeb7e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Dec 2024 15:17:50 +0800 Subject: Implement SASL stub --- clients.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clients.go') diff --git a/clients.go b/clients.go index 2719b08..b141cf8 100644 --- a/clients.go +++ b/clients.go @@ -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) -- cgit v1.2.3