diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-14 22:49:51 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 5e712d7145846b9b16a8dbc40ec06f2b8c1a7273 (patch) | |
tree | b5af71e246444c628eaa369449561b82fa629fa1 /src/plugins/irc | |
parent | 8ea41d91c98959e519c4ddfa220ea521c9d041a9 (diff) | |
download | weechat-5e712d7145846b9b16a8dbc40ec06f2b8c1a7273.zip |
irc: use parsed command parameters in "pong" command callback
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index b927f388e..6c02a59d7 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -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; |