diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-09 20:43:24 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-09 20:43:24 +0200 |
commit | dd41e5776f2a374f43dda14f1736a0fe512946d9 (patch) | |
tree | dbca1c8e6535f3e664f2abd20dd439ec04ac3360 /src/plugins/relay | |
parent | 424b8c89cc603dfb3b201822a219c18536698c29 (diff) | |
download | weechat-dd41e5776f2a374f43dda14f1736a0fe512946d9.zip |
relay: add command "ping" in weechat protocol (task #12689)
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 04915e981..40620e2fd 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -1091,6 +1091,34 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(test) } /* + * Callback for command "ping" (from client). + * + * Message looks like: + * ping + * ping 1370802127000 + */ + +RELAY_WEECHAT_PROTOCOL_CALLBACK(ping) +{ + struct t_relay_weechat_msg *msg; + + RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0); + + msg = relay_weechat_msg_new ("_pong"); + if (msg) + { + relay_weechat_msg_add_type (msg, RELAY_WEECHAT_MSG_OBJ_STRING); + relay_weechat_msg_add_string (msg, (argc > 0) ? argv_eol[0] : ""); + + /* send message */ + relay_weechat_msg_send (client, msg); + relay_weechat_msg_free (msg); + } + + return WEECHAT_RC_OK; +} + +/* * Callback for command "quit" (from client). * * Message looks like: @@ -1125,6 +1153,7 @@ relay_weechat_protocol_recv (struct t_relay_client *client, const char *data) { "sync", &relay_weechat_protocol_cb_sync }, { "desync", &relay_weechat_protocol_cb_desync }, { "test", &relay_weechat_protocol_cb_test }, + { "ping", &relay_weechat_protocol_cb_ping }, { "quit", &relay_weechat_protocol_cb_quit }, { NULL, NULL } }; |