summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-16 09:25:34 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commit3360cadd55bd265b8c5e1185c291f9d9a8ca4969 (patch)
treeb5f53471d8a6009609c20a4bce06f663e36ba175 /src/plugins/irc
parentf51f3dbe299d817b208c26a8ff4dedccb4465607 (diff)
downloadweechat-3360cadd55bd265b8c5e1185c291f9d9a8ca4969.zip
irc: use parsed command parameters in "whois" and "whowas" command callbacks
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-protocol.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index de21811b3..21ff5d8f0 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3871,26 +3871,33 @@ IRC_PROTOCOL_CALLBACK(306)
* Callback for the whois commands with nick and message.
*
* Command looks like:
- * :server 319 flashy FlashCode :some text here
+ * 319 flashy FlashCode :some text here
*/
IRC_PROTOCOL_CALLBACK(whois_nick_msg)
{
- IRC_PROTOCOL_MIN_ARGS(5);
+ char *str_params;
+
+ IRC_PROTOCOL_MIN_PARAMS(3);
+
+ str_params = irc_protocol_string_params (params, 2, 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",
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_RESET,
- (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
+ str_params);
+
+ if (str_params)
+ free (str_params);
return WEECHAT_RC_OK;
}
@@ -3899,26 +3906,33 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
* Callback for the whowas commands with nick and message.
*
* Command looks like:
- * :server 369 flashy FlashCode :some text here
+ * 369 flashy FlashCode :some text here
*/
IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
{
- IRC_PROTOCOL_MIN_ARGS(5);
+ char *str_params;
+
+ IRC_PROTOCOL_MIN_PARAMS(3);
+
+ str_params = irc_protocol_string_params (params, 2, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
- server, argv[3], command, "whowas", NULL),
+ server, params[1], command, "whowas", NULL),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%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_RESET,
- (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
+ str_params);
+
+ if (str_params)
+ free (str_params);
return WEECHAT_RC_OK;
}