diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-08 10:32:29 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-08 10:32:29 +0800 |
commit | 6bbe00f0c7aae6c468b1a3e12983a74a170e92b8 (patch) | |
tree | 970b43288cdbb8c05cf5df2aaaf79e94019d13af /cmd_cap.go | |
parent | Remove another unnecessary anonymous function (diff) | |
download | meseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.tar.gz meseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.tar.zst meseircd-6bbe00f0c7aae6c468b1a3e12983a74a170e92b8.zip |
Handle send failures
Diffstat (limited to 'cmd_cap.go')
-rw-r--r-- | cmd_cap.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -8,15 +8,21 @@ func init() { commandHandlers["CAP"] = handleClientCap } -func handleClientCap(msg RMsg, client *Client) bool { +func handleClientCap(msg RMsg, client *Client) error { if len(msg.Params) < 1 { - client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "CAP", "Not enough parameters")) - return true + err := client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "CAP", "Not enough parameters")) + if err != nil { + return err + } + return nil } switch strings.ToUpper(msg.Params[0]) { case "LS": - client.Send(MakeMsg(self, "CAP", client.Nick, "LS", "sasl=PLAIN,EXTERNAL")) + err := client.Send(MakeMsg(self, "CAP", client.Nick, "LS", "sasl=PLAIN,EXTERNAL")) + if err != nil { + return err + } case "REQ": } - return true + return nil } |