blob: 93ee17e0dfbe974d0b6006a8227d05cb26d045f3 (
plain) (
tree)
|
|
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
}
|