blob: bf8df6483cc07640162161ab9b80a40dcb825c82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
// "log/slog"
)
func init() {
commandHandlers["USER"] = handleClientUser
}
func handleClientUser(msg RMsg, client *Client) error {
if len(msg.Params) < 4 {
return client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "USER", "Not enough parameters"))
}
switch {
case client.State < ClientStateRegistered:
client.Ident = "~" + msg.Params[0]
client.Gecos = msg.Params[3]
err := client.checkRegistration()
if err != nil {
return err
}
case client.State == ClientStateRegistered:
err := client.Send(MakeMsg(self, ERR_ALREADYREGISTERED, client.Nick, "You may not reregister"))
if err != nil {
return err
}
case client.State == ClientStateRemote:
}
return nil
}
|