diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-05-20 22:22:20 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-05-20 22:22:20 +0200 |
commit | 3c29f92e9bc60b9a61aea9d8486bc532266d43e2 (patch) | |
tree | 2e84279f955e6dbdb0b9fe1135c5e8b5c7291009 | |
parent | 6b8f45f3bb52c638c09f4617664762166b36ed58 (diff) | |
parent | d4296a02c02661a0faa1923e449a4d728db8e252 (diff) | |
download | weechat-3c29f92e9bc60b9a61aea9d8486bc532266d43e2.zip |
Merge remote-tracking branch 'origin/pr/639'
-rw-r--r-- | src/plugins/irc/irc-command.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 54 |
3 files changed, 43 insertions, 15 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 34a0d5bcb..3ee172c06 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -6357,7 +6357,7 @@ irc_command_init () "\n" "Capabilities supported by WeeChat are: " "account-notify, away-notify, cap-notify, extended-join, " - "multi-prefix, server-time, userhost-in-names.\n" + "invite-notify, multi-prefix, server-time, userhost-in-names.\n" "\n" "The capabilities to automatically enable on servers can be set " "in option irc.server_default.capabilities (or by server in " diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h index c6a31dc57..b6ec7b64f 100644 --- a/src/plugins/irc/irc-command.h +++ b/src/plugins/irc/irc-command.h @@ -52,7 +52,7 @@ struct t_irc_channel; /* list of supported capabilities (for completion in command /cap) */ #define IRC_COMMAND_CAP_SUPPORTED_COMPLETION \ "account-notify|away-notify|cap-notify|extended-join|" \ - "multi-prefix|server-time|userhost-in-names|%*" + "invite-notify|multi-prefix|server-time|userhost-in-names|%*" /* list of supported CTCPs (for completion in command /ctcp) */ #define IRC_COMMAND_CTCP_SUPPORTED_COMPLETION \ diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 862ba212a..e6de0c398 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -853,6 +853,11 @@ IRC_PROTOCOL_CALLBACK(generic_error) * * Message looks like: * :nick!user@host INVITE mynick :#channel + * + * With invite-notify capability + * (http://ircv3.net/specs/extensions/invite-notify-3.2.html): + * :<inviter> INVITE <target> <channel> + * :ChanServ!ChanServ@example.com INVITE Attila #channel */ IRC_PROTOCOL_CALLBACK(invite) @@ -863,18 +868,41 @@ IRC_PROTOCOL_CALLBACK(invite) if (ignored) return WEECHAT_RC_OK; - weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), - date, - irc_protocol_tags (command, "notify_highlight", nick, address), - _("%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], - IRC_COLOR_RESET, - irc_nick_color_for_msg (server, 1, NULL, nick), - nick, - IRC_COLOR_RESET); + if (irc_server_strcasecmp (server, argv[2], server->nick) == 0) + { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), + date, + irc_protocol_tags (command, "notify_highlight", nick, address), + _("%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], + IRC_COLOR_RESET, + irc_nick_color_for_msg (server, 1, NULL, nick), + nick, + IRC_COLOR_RESET); + } + else + { + /* CAP invite-notify */ + /* imitate numeric 341 output */ + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, nick, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, nick, address), + _("%s%s%s%s has invited %s%s%s to %s%s%s"), + weechat_prefix ("network"), + 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_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + (argv[3][0] == ':') ? argv[3] + 1 : argv[3], + IRC_COLOR_RESET); + } return WEECHAT_RC_OK; } @@ -3928,7 +3956,7 @@ IRC_PROTOCOL_CALLBACK(341) weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), date, - irc_protocol_tags (command, "irc_numeric", NULL, address), + irc_protocol_tags (command, "irc_numeric", argv[2], address), _("%s%s%s%s has invited %s%s%s to %s%s%s"), weechat_prefix ("network"), irc_nick_color_for_msg (server, 1, NULL, argv[2]), |