diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 11:36:36 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 32ae101096fe1c508c793cfc699adc127e5a84c3 (patch) | |
tree | c8dd840db6689b4ffc42c974cb485f185b91d351 /src/plugins/irc | |
parent | 3a5a2abeead301d4454e613ddb30da19781f2284 (diff) | |
download | weechat-32ae101096fe1c508c793cfc699adc127e5a84c3.zip |
irc: use parsed command parameters in "333" command callback
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 2f1aa9a98..e456604e0 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4677,8 +4677,8 @@ IRC_PROTOCOL_CALLBACK(332) * Callback for the IRC command "333": infos about topic (nick / date). * * Command looks like: - * :server 333 mynick #channel nick!user@host 1205428096 - * :server 333 mynick #channel 1205428096 + * 333 mynick #channel nick!user@host 1205428096 + * 333 mynick #channel 1205428096 */ IRC_PROTOCOL_CALLBACK(333) @@ -4687,21 +4687,19 @@ IRC_PROTOCOL_CALLBACK(333) struct t_irc_nick *ptr_nick; time_t datetime; const char *topic_nick, *topic_address; - int arg_date; - IRC_PROTOCOL_MIN_ARGS(5); + IRC_PROTOCOL_MIN_PARAMS(3); - topic_nick = (argc > 5) ? irc_message_get_nick_from_host (argv[4]) : NULL; - topic_address = (argc > 5) ? irc_message_get_address_from_host (argv[4]) : NULL; + topic_nick = (num_params > 3) ? irc_message_get_nick_from_host (params[2]) : NULL; + topic_address = (num_params > 3) ? irc_message_get_address_from_host (params[2]) : NULL; if (topic_nick && topic_address && strcmp (topic_nick, topic_address) == 0) topic_address = NULL; - ptr_channel = irc_channel_search (server, argv[3]); + ptr_channel = irc_channel_search (server, params[1]); ptr_nick = (ptr_channel) ? irc_nick_search (server, ptr_channel, topic_nick) : NULL; - arg_date = (argc > 5) ? 5 : 4; - datetime = (time_t)(atol ((argv_eol[arg_date][0] == ':') ? - argv_eol[arg_date] + 1 : argv_eol[arg_date])); + datetime = (num_params > 3) ? + (time_t)(atol (params[3])) : (time_t)(atol (params[2])); if (!topic_nick && (datetime == 0)) return WEECHAT_RC_OK; @@ -4759,7 +4757,7 @@ IRC_PROTOCOL_CALLBACK(333) _("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_RESET, irc_nick_color_for_msg (server, 1, ptr_nick, topic_nick), topic_nick, @@ -4783,7 +4781,7 @@ IRC_PROTOCOL_CALLBACK(333) _("%sTopic for %s%s%s set on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_RESET, weechat_util_get_time_string (&datetime)); } |