mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
irc: use parsed command parameters in "pong" command callback
This commit is contained in:
@@ -2546,14 +2546,15 @@ IRC_PROTOCOL_CALLBACK(ping)
|
||||
* Callback for the IRC command "PONG".
|
||||
*
|
||||
* Command looks like:
|
||||
* :server PONG server :arguments
|
||||
* PONG server :arguments
|
||||
*/
|
||||
|
||||
IRC_PROTOCOL_CALLBACK(pong)
|
||||
{
|
||||
struct timeval tv;
|
||||
char *str_params;
|
||||
|
||||
IRC_PROTOCOL_MIN_ARGS(0);
|
||||
IRC_PROTOCOL_MIN_PARAMS(0);
|
||||
|
||||
if (server->lag_check_time.tv_sec != 0)
|
||||
{
|
||||
@@ -2577,14 +2578,17 @@ IRC_PROTOCOL_CALLBACK(pong)
|
||||
}
|
||||
else
|
||||
{
|
||||
str_params = (num_params > 1) ?
|
||||
irc_protocol_string_params (params, 1, num_params - 1) : NULL;
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
|
||||
date,
|
||||
irc_protocol_tags (command, NULL, NULL, NULL),
|
||||
"PONG%s%s",
|
||||
(argc >= 4) ? ": " : "",
|
||||
(argc >= 4) ? ((argv_eol[3][0] == ':') ?
|
||||
argv_eol[3] + 1 : argv_eol[3]) : "");
|
||||
(str_params) ? ": " : "",
|
||||
(str_params) ? str_params : "");
|
||||
if (str_params)
|
||||
free (str_params);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -1549,8 +1549,10 @@ TEST(IrcProtocolWithServer, pong)
|
||||
CHECK_SRV("PONG");
|
||||
RECV(":server PONG server");
|
||||
CHECK_SRV("PONG");
|
||||
RECV(":server PONG server :srv");
|
||||
CHECK_SRV("PONG: srv");
|
||||
RECV(":server PONG server :info");
|
||||
CHECK_SRV("PONG: info");
|
||||
RECV(":server PONG server :extra info");
|
||||
CHECK_SRV("PONG: extra info");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user