summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-protocol.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-16 09:39:00 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commitc577da0375c8f75a073d63e582a5a37a7ed2c782 (patch)
treeccc272aea889997a395acdb758b6c3e3e62775d7 /src/plugins/irc/irc-protocol.c
parent4e1d40034e31007fe619739051cd1c8e80b1f7b9 (diff)
downloadweechat-c577da0375c8f75a073d63e582a5a37a7ed2c782.zip
irc: use parsed command parameters in "321" command callback
Diffstat (limited to 'src/plugins/irc/irc-protocol.c')
-rw-r--r--src/plugins/irc/irc-protocol.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index dd426010b..5510cccaa 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -4192,17 +4192,16 @@ IRC_PROTOCOL_CALLBACK(317)
* Callback for the IRC command "321": /list start.
*
* Command looks like:
- * :server 321 mynick Channel :Users Name
+ * 321 mynick Channel :Users Name
*/
IRC_PROTOCOL_CALLBACK(321)
{
- char *pos_args;
+ char *str_params;
- IRC_PROTOCOL_MIN_ARGS(4);
+ IRC_PROTOCOL_MIN_PARAMS(2);
- pos_args = (argc > 4) ?
- ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
+ str_params = irc_protocol_string_params (params, 2, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
@@ -4211,9 +4210,12 @@ IRC_PROTOCOL_CALLBACK(321)
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s%s%s",
weechat_prefix ("network"),
- argv[3],
- (pos_args) ? " " : "",
- (pos_args) ? pos_args : "");
+ params[1],
+ (str_params && str_params[0]) ? " " : "",
+ (str_params && str_params[0]) ? str_params : "");
+
+ if (str_params)
+ free (str_params);
return WEECHAT_RC_OK;
}