diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 18:30:13 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | c7cb025582936070cad90916d60186671ad47523 (patch) | |
tree | c4bc8dc7567f6336dc72f7c12a32139fef55e4cb /src | |
parent | 96288d69e2d7fd5bebe21c846fc07311b985b350 (diff) | |
download | weechat-c7cb025582936070cad90916d60186671ad47523.zip |
irc: use parsed command parameters in "368" command callback
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 112cf0e53..c91bc2a43 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -6073,25 +6073,27 @@ IRC_PROTOCOL_CALLBACK(367) * Callback for the IRC command "368": end of banlist. * * Command looks like: - * :server 368 mynick #channel :End of Channel Ban List + * 368 mynick #channel :End of Channel Ban List */ IRC_PROTOCOL_CALLBACK(368) { - char *pos_args; + char *str_params; struct t_irc_channel *ptr_channel; struct t_gui_buffer *ptr_buffer; struct t_irc_modelist *ptr_modelist; - 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 = (num_params > 2) ? + irc_protocol_string_params (params, 2, num_params - 1) : NULL; - ptr_channel = irc_channel_search (server, argv[3]); + ptr_channel = irc_channel_search (server, params[1]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; - ptr_modelist = irc_modelist_search (ptr_channel, 'b'); + ptr_modelist = (ptr_channel) ? + irc_modelist_search (ptr_channel, 'b') : NULL; + if (ptr_modelist) { if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING) @@ -6104,6 +6106,7 @@ IRC_PROTOCOL_CALLBACK(368) } ptr_modelist->state = IRC_MODELIST_STATE_RECEIVED; } + weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "banlist", ptr_buffer), @@ -6113,11 +6116,14 @@ IRC_PROTOCOL_CALLBACK(368) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (pos_args) ? " " : "", - (pos_args) ? pos_args : ""); + (str_params) ? " " : "", + (str_params) ? str_params : ""); + + if (str_params) + free (str_params); return WEECHAT_RC_OK; } |