From 7fe8fe6c9fff814b88929026384f1851ff321781 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Dec 2024 10:13:58 +0800 Subject: Registration --- clients.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'clients.go') diff --git a/clients.go b/clients.go index 53fd134..15512c0 100644 --- a/clients.go +++ b/clients.go @@ -1,8 +1,8 @@ package main import ( - "net" "log/slog" + "net" "sync" ) @@ -11,6 +11,7 @@ type Client struct { UID string Nick string Ident string + Gecos string Host string Server Server State ClientState @@ -57,6 +58,16 @@ func (client *Client) Teardown() { } } +func (client *Client) checkRegistration() { + if client.State != ClientStatePreRegistration { + slog.Error("spurious call to checkRegistration", "client", client) + return // TODO: Return an error? + } + if client.Nick != "*" && client.Ident != "" { + client.Send(MakeMsg(self, RPL_WELCOME, client.Nick, "Welcome")) + } +} + type ClientState uint8 const ( -- cgit v1.2.3