diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-11 00:10:34 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 3c737ca30433b884a8bdde5886c6d21a79baef90 (patch) | |
tree | c5b8c333ec4d15385129f74e440265c1d2c59c9f /src | |
parent | 1f83df7a18a9ac354e44ae422be85cfdc73c7c2a (diff) | |
download | weechat-3c737ca30433b884a8bdde5886c6d21a79baef90.zip |
irc: use parsed command parameters in "invite" command callback
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index af1f36890..9961c81a5 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1350,23 +1350,26 @@ IRC_PROTOCOL_CALLBACK(fail) * Callback for the IRC command "INVITE". * * Command looks like: - * :nick!user@host INVITE mynick :#channel + * INVITE mynick :#channel * - * With invite-notify capability - * (https://ircv3.net/specs/extensions/invite-notify-3.2.html): + * With invite-notify capability, the whole message looks like: * :<inviter> INVITE <target> <channel> * :ChanServ!ChanServ@example.com INVITE Attila #channel + * + * For more information, see: + * https://ircv3.net/specs/extensions/invite-notify-3.2.html */ IRC_PROTOCOL_CALLBACK(invite) { - IRC_PROTOCOL_MIN_ARGS(4); - IRC_PROTOCOL_CHECK_HOST; + IRC_PROTOCOL_MIN_PARAMS(2); + IRC_PROTOCOL_CHECK_NICK; + IRC_PROTOCOL_CHECK_ADDRESS; if (ignored) return WEECHAT_RC_OK; - if (irc_server_strcasecmp (server, argv[2], server->nick) == 0) + if (irc_server_strcasecmp (server, params[0], server->nick) == 0) { weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), @@ -1375,7 +1378,7 @@ IRC_PROTOCOL_CALLBACK(invite) _("%sYou have been invited to %s%s%s by %s%s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - (argv[3][0] == ':') ? argv[3] + 1 : argv[3], + params[1], IRC_COLOR_RESET, irc_nick_color_for_msg (server, 1, NULL, nick), nick, @@ -1394,11 +1397,11 @@ IRC_PROTOCOL_CALLBACK(invite) irc_nick_color_for_msg (server, 1, NULL, nick), nick, IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, NULL, argv[2]), - argv[2], + irc_nick_color_for_msg (server, 1, NULL, params[0]), + params[0], IRC_COLOR_RESET, IRC_COLOR_CHAT_CHANNEL, - (argv[3][0] == ':') ? argv[3] + 1 : argv[3], + params[1], IRC_COLOR_RESET); } |