diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 09:25:59 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 572bcc2c597d4b60595bf22dc48fa0931ddd6696 (patch) | |
tree | fe6ccedba043d4e3f9b3538c90e59391b651d4f0 /src/plugins/irc | |
parent | 3360cadd55bd265b8c5e1185c291f9d9a8ca4969 (diff) | |
download | weechat-572bcc2c597d4b60595bf22dc48fa0931ddd6696.zip |
irc: use parsed command parameters in "311" command callback
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 21ff5d8f0..c9e2d7b49 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3941,30 +3941,37 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg) * Callback for the IRC command "311": whois, user. * * Command looks like: - * :server 311 mynick nick user host * :realname here + * 311 mynick nick user host * :realname here */ IRC_PROTOCOL_CALLBACK(311) { - IRC_PROTOCOL_MIN_ARGS(8); + char *str_params; + + IRC_PROTOCOL_MIN_PARAMS(6); + + str_params = irc_protocol_string_params (params, 5, num_params - 1); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( - server, argv[3], command, "whois", NULL), + server, params[1], command, "whois", NULL), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), "%s%s[%s%s%s] (%s%s@%s%s)%s: %s", weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, - irc_nick_color_for_msg (server, 1, NULL, argv[3]), - argv[3], + irc_nick_color_for_msg (server, 1, NULL, params[1]), + params[1], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - argv[4], - argv[5], + params[2], + params[3], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]); + str_params); + + if (str_params) + free (str_params); return WEECHAT_RC_OK; } |