diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-09-15 20:31:06 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-09-15 20:31:06 +0200 |
commit | c6d8b544599b6907e201848060666b84bc82212a (patch) | |
tree | 6948cabed7424907c4674d4af8a8ae4ff4f57e73 /src/plugins/irc | |
parent | 82f59d2a9882f272577cc78c0e484d2c95eba78b (diff) | |
download | weechat-c6d8b544599b6907e201848060666b84bc82212a.zip |
irc: add option irc.look.display_pv_nick_change
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-config.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 44 |
3 files changed, 51 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index c989120cd..a3df1a726 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -72,6 +72,7 @@ struct t_config_option *irc_config_look_display_join_message; struct t_config_option *irc_config_look_display_old_topic; struct t_config_option *irc_config_look_display_pv_away_once; struct t_config_option *irc_config_look_display_pv_back; +struct t_config_option *irc_config_look_display_pv_nick_change; struct t_config_option *irc_config_look_display_pv_warning_address; struct t_config_option *irc_config_look_highlight_channel; struct t_config_option *irc_config_look_highlight_pv; @@ -2904,6 +2905,12 @@ irc_config_init () "server)"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_pv_nick_change = weechat_config_new_option ( + irc_config_file, ptr_section, + "display_pv_nick_change", "boolean", + N_("display nick change in private"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_display_pv_warning_address = weechat_config_new_option ( irc_config_file, ptr_section, "display_pv_warning_address", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 570b22b85..8f8c616f0 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -112,6 +112,7 @@ extern struct t_config_option *irc_config_look_display_join_message; extern struct t_config_option *irc_config_look_display_old_topic; extern struct t_config_option *irc_config_look_display_pv_away_once; extern struct t_config_option *irc_config_look_display_pv_back; +extern struct t_config_option *irc_config_look_display_pv_nick_change; extern struct t_config_option *irc_config_look_display_pv_warning_address; extern struct t_config_option *irc_config_look_highlight_channel; extern struct t_config_option *irc_config_look_highlight_pv; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 64098ebf8..acf754dff 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2007,7 +2007,7 @@ IRC_PROTOCOL_CALLBACK(nick) { struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick, *ptr_nick_found; - char *old_color, str_tags[512], *buffer_name; + char *old_color, *new_color, str_tags[512], *buffer_name; int local_nick, smart_filter; struct t_irc_channel_speaking *ptr_nick_speaking; @@ -2081,6 +2081,48 @@ IRC_PROTOCOL_CALLBACK(nick) ptr_channel->name); if (buffer_name) free (buffer_name); + if (weechat_config_boolean (irc_config_look_display_pv_nick_change)) + { + if (weechat_config_boolean (irc_config_look_color_nicks_in_server_messages)) + { + if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel)) + { + old_color = irc_nick_find_color (nick); + new_color = irc_nick_find_color (params[0]); + } + else + { + old_color = strdup (IRC_COLOR_CHAT_NICK_OTHER); + new_color = strdup (IRC_COLOR_CHAT_NICK_OTHER); + } + } + else + { + old_color = strdup (IRC_COLOR_CHAT_NICK); + new_color = strdup (IRC_COLOR_CHAT_NICK); + } + snprintf (str_tags, sizeof (str_tags), + "irc_nick1_%s,irc_nick2_%s", + nick, + params[0]); + weechat_printf_date_tags ( + ptr_channel->buffer, + date, + irc_protocol_tags (command, tags, str_tags, + NULL, address), + _("%s%s%s%s is now known as %s%s%s"), + weechat_prefix ("network"), + old_color, + nick, + IRC_COLOR_RESET, + new_color, + params[0], + IRC_COLOR_RESET); + if (old_color) + free (old_color); + if (new_color) + free (new_color); + } } break; case IRC_CHANNEL_TYPE_CHANNEL: |