diff options
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 2aa4e10d7..f40f0f010 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -720,6 +720,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) @@ -730,18 +735,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; } @@ -3768,7 +3796,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]), |