diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-08 08:45:13 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-08 01:20:26 +0800 |
commit | d810d12355873d3eaf61ed3f7f0ae52db06c2c96 (patch) | |
tree | 5cfa6d11c31377b459b06f4e3399bcc0542c57d8 /cmd_ping.go | |
parent | Slight refactor (diff) | |
download | meseircd-d810d12355873d3eaf61ed3f7f0ae52db06c2c96.tar.gz meseircd-d810d12355873d3eaf61ed3f7f0ae52db06c2c96.tar.zst meseircd-d810d12355873d3eaf61ed3f7f0ae52db06c2c96.zip |
Add basic command handling
Diffstat (limited to 'cmd_ping.go')
-rw-r--r-- | cmd_ping.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd_ping.go b/cmd_ping.go new file mode 100644 index 0000000..4ad07c5 --- /dev/null +++ b/cmd_ping.go @@ -0,0 +1,13 @@ +package main + +func init() { + commandHandlers["PING"] = handleClientPing +} + +func handleClientPing(msg RMsg, client *Client) (error) { + if len(msg.Params) < 1 { + client.Send(SMsg{Command: ERR_NEEDMOREPARAMS, Params: []string{"PING", "Not enough parameters"}}) + } + client.Send(SMsg{Command: "PONG", Params: []string{msg.Params[0]}}) + return nil +} |