aboutsummaryrefslogtreecommitdiff
path: root/cmd_ping.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd_ping.go')
-rw-r--r--cmd_ping.go13
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
+}