mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 16:23:14 +02:00
relay: add command "ping" in weechat protocol (task #12689)
This commit is contained in:
@@ -1090,6 +1090,34 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(test)
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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).
|
||||
*
|
||||
@@ -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 }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user