aboutsummaryrefslogblamecommitdiff
path: root/cmd_user.go
blob: 3db56c76eadbb0d5df5f33f37612c36c0221b7a6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                               



                                                  
                                          


                                                                                                        


                   
package main

import (
// "log/slog"
)

func init() {
	commandHandlers["USER"] = handleClientUser
}

func handleClientUser(msg RMsg, client *Client) bool {
	if len(msg.Params) < 4 {
		client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "USER", "Not enough parameters"))
		return true
	}
	switch (client.State) {
	case ClientStatePreRegistration:
		client.Ident = "~" + msg.Params[0]
		client.Gecos = msg.Params[3]
		client.checkRegistration()
	case ClientStateRegistered:
		client.Send(MakeMsg(self, ERR_ALREADYREGISTERED, client.Nick, "You may not reregister"))
	case ClientStateRemote:
	}
	return true
}