diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-13 22:15:29 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-13 22:16:46 +0200 |
commit | d3b84eaf6c5235b473b46d83234d10369861b039 (patch) | |
tree | 93c4281d4fd5cf800e1eddaa9503d6209ee58126 /src/plugins | |
parent | ac50a5dda7573052b269821a85d0d437b70b92c2 (diff) | |
download | weechat-d3b84eaf6c5235b473b46d83234d10369861b039.zip |
irc: display CHGHOST command in private buffers
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 96 |
1 files changed, 62 insertions, 34 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index a082e5275..4af1b0e31 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1226,41 +1226,69 @@ IRC_PROTOCOL_CALLBACK(chghost) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - ptr_nick = irc_nick_search (server, ptr_channel, nick); - if (ptr_nick) + switch (ptr_channel->type) { - if (!ignored) - { - ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter)) - && (weechat_config_boolean (irc_config_look_smart_filter_chghost))) ? - irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL; - smart_filter = (!local_chghost - && weechat_config_boolean (irc_config_look_smart_filter) - && weechat_config_boolean (irc_config_look_smart_filter_chghost) - && !ptr_nick_speaking); - - weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer ( - server, NULL, command, NULL, ptr_channel->buffer), - date, - irc_protocol_tags ( - command, - tags, - smart_filter ? "irc_smart_filter" : NULL, - nick, address), - _("%s%s%s%s (%s%s%s)%s has changed host to %s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (server, 1, ptr_nick, nick), - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - (address) ? address : "", - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_MESSAGE_CHGHOST, - IRC_COLOR_CHAT_HOST, - str_host); - } - irc_nick_set_host (ptr_nick, str_host); + case IRC_CHANNEL_TYPE_PRIVATE: + if (!ignored + && (irc_server_strcasecmp (server, + ptr_channel->name, nick) == 0)) + { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags (command, tags, NULL, nick, address), + _("%s%s%s%s (%s%s%s)%s has changed host to %s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + (address) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_MESSAGE_CHGHOST, + IRC_COLOR_CHAT_HOST, + str_host); + } + break; + case IRC_CHANNEL_TYPE_CHANNEL: + ptr_nick = irc_nick_search (server, ptr_channel, nick); + if (ptr_nick) + { + if (!ignored) + { + ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter)) + && (weechat_config_boolean (irc_config_look_smart_filter_chghost))) ? + irc_channel_nick_speaking_time_search (server, ptr_channel, nick, 1) : NULL; + smart_filter = (!local_chghost + && weechat_config_boolean (irc_config_look_smart_filter) + && weechat_config_boolean (irc_config_look_smart_filter_chghost) + && !ptr_nick_speaking); + + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, NULL, command, NULL, ptr_channel->buffer), + date, + irc_protocol_tags ( + command, + tags, + smart_filter ? "irc_smart_filter" : NULL, + nick, address), + _("%s%s%s%s (%s%s%s)%s has changed host to %s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, ptr_nick, nick), + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + (address) ? address : "", + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_MESSAGE_CHGHOST, + IRC_COLOR_CHAT_HOST, + str_host); + } + irc_nick_set_host (ptr_nick, str_host); + } + break; } } |