aboutsummaryrefslogtreecommitdiff
path: root/cmd_user.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 10:32:29 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 10:32:29 +0800
commit6bbe00f0c7aae6c468b1a3e12983a74a170e92b8 (patch)
tree970b43288cdbb8c05cf5df2aaaf79e94019d13af /cmd_user.go
parentRemove another unnecessary anonymous function (diff)
downloadmeseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.tar.gz
meseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.tar.zst
meseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.zip
Handle send failures
Diffstat (limited to 'cmd_user.go')
-rw-r--r--cmd_user.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/cmd_user.go b/cmd_user.go
index 06fd7a3..4c4c86a 100644
--- a/cmd_user.go
+++ b/cmd_user.go
@@ -8,19 +8,24 @@ func init() {
commandHandlers["USER"] = handleClientUser
}
-func handleClientUser(msg RMsg, client *Client) bool {
+func handleClientUser(msg RMsg, client *Client) error {
if len(msg.Params) < 4 {
- client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "USER", "Not enough parameters"))
- return true
+ return client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "USER", "Not enough parameters"))
}
switch client.State {
case ClientStatePreRegistration:
client.Ident = "~" + msg.Params[0]
client.Gecos = msg.Params[3]
- client.checkRegistration()
+ err := client.checkRegistration()
+ if err != nil {
+ return err
+ }
case ClientStateRegistered:
- client.Send(MakeMsg(self, ERR_ALREADYREGISTERED, client.Nick, "You may not reregister"))
+ err := client.Send(MakeMsg(self, ERR_ALREADYREGISTERED, client.Nick, "You may not reregister"))
+ if err != nil {
+ return err
+ }
case ClientStateRemote:
}
- return true
+ return nil
}