diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 13:04:22 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 2ae974f5c38176f5e119bc0dcd252e0c34fd2aea (patch) | |
tree | ce63ab826c688f629c46da4e24aa26f07ece9270 /src/plugins | |
parent | 99d565f6df803dd4feb0ca2b4bcbcaeac2fe7ea3 (diff) | |
download | weechat-2ae974f5c38176f5e119bc0dcd252e0c34fd2aea.zip |
irc: use parsed command parameters in "346" command callback
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index df08e5664..51c47c0fd 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4930,8 +4930,8 @@ IRC_PROTOCOL_CALLBACK(345) * Callback for the IRC command "346": channel invite list. * * Command looks like: - * :server 346 mynick #channel invitemask nick!user@host 1205590879 - * :server 346 mynick #channel invitemask + * 346 mynick #channel invitemask nick!user@host 1205590879 + * 346 mynick #channel invitemask */ IRC_PROTOCOL_CALLBACK(346) @@ -4943,9 +4943,9 @@ IRC_PROTOCOL_CALLBACK(346) const char *nick_address; char str_number[64]; - IRC_PROTOCOL_MIN_ARGS(5); + IRC_PROTOCOL_MIN_PARAMS(3); - 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, 'I'); @@ -4969,16 +4969,16 @@ IRC_PROTOCOL_CALLBACK(346) else str_number[0] = '\0'; - if (argc >= 6) + if (num_params >= 4) { nick_address = irc_protocol_nick_address ( - server, 1, NULL, irc_message_get_nick_from_host (argv[5]), - irc_message_get_address_from_host (argv[5])); - if (argc >= 7) + server, 1, NULL, irc_message_get_nick_from_host (params[3]), + irc_message_get_address_from_host (params[3])); + if (num_params >= 5) { - datetime = (time_t)(atol ((argv[6][0] == ':') ? argv[6] + 1 : argv[6])); + datetime = (time_t)(atol (params[4])); if (ptr_modelist) - irc_modelist_item_new (ptr_modelist, argv[4], argv[5], datetime); + irc_modelist_item_new (ptr_modelist, params[2], params[3], datetime); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "invitelist", ptr_buffer), @@ -4989,11 +4989,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - argv[4], + params[2], IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); @@ -5001,7 +5001,7 @@ IRC_PROTOCOL_CALLBACK(346) else { if (ptr_modelist) - irc_modelist_item_new (ptr_modelist, argv[4], argv[5], 0); + irc_modelist_item_new (ptr_modelist, params[2], params[3], 0); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "invitelist", ptr_buffer), @@ -5011,11 +5011,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - argv[4], + params[2], IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } @@ -5023,7 +5023,7 @@ IRC_PROTOCOL_CALLBACK(346) else { if (ptr_modelist) - irc_modelist_item_new (ptr_modelist, argv[4], NULL, 0); + irc_modelist_item_new (ptr_modelist, params[2], NULL, 0); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "invitelist", ptr_buffer), @@ -5033,11 +5033,11 @@ IRC_PROTOCOL_CALLBACK(346) weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, - argv[4], + params[2], IRC_COLOR_RESET); } |