diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-03-04 14:11:35 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-03-04 14:11:35 +0100 |
commit | 7351c709f874c439d3d5f27e9c6b38581800489c (patch) | |
tree | 9a467aabefc875cff08bf45d33cc6794600adb46 /src | |
parent | e8df46c0050d6d2d1f9e1eb35a59d379636fb48c (diff) | |
download | weechat-7351c709f874c439d3d5f27e9c6b38581800489c.zip |
Add new option irc.look.color_nicks_in_names
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-config.c | 8 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 17 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 7eadd3cf4..4c5ef2995 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -50,6 +50,7 @@ struct t_config_section *irc_config_section_server = NULL; /* IRC config, look section */ +struct t_config_option *irc_config_look_color_nicks_in_names; struct t_config_option *irc_config_look_color_nicks_in_nicklist; struct t_config_option *irc_config_look_color_nicks_in_server_messages; struct t_config_option *irc_config_look_color_pv_nick_like_channel; @@ -1791,6 +1792,13 @@ irc_config_init () return 0; } + irc_config_look_color_nicks_in_names = weechat_config_new_option ( + irc_config_file, ptr_section, + "color_nicks_in_names", "boolean", + N_("use nick color in output of /names (or list of nicks displayed " + "when joining a channel)"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, + NULL, NULL, NULL, NULL); irc_config_look_color_nicks_in_nicklist = weechat_config_new_option ( irc_config_file, ptr_section, "color_nicks_in_nicklist", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 890617df3..2902af8ee 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -75,6 +75,7 @@ extern struct t_config_section *irc_config_section_ctcp; extern struct t_config_section *irc_config_section_server_default; extern struct t_config_section *irc_config_section_server; +extern struct t_config_option *irc_config_look_color_nicks_in_names; extern struct t_config_option *irc_config_look_color_nicks_in_nicklist; extern struct t_config_option *irc_config_look_color_nicks_in_server_messages; extern struct t_config_option *irc_config_look_color_pv_nick_like_channel; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index b3e7ab883..1ad558517 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3539,7 +3539,7 @@ IRC_PROTOCOL_CALLBACK(366) struct t_config_option *ptr_option; int num_nicks, num_op, num_halfop, num_voice, num_normal, length, i; char *string; - const char *prefix; + const char *prefix, *nickname; /* * 366 message looks like: @@ -3568,7 +3568,7 @@ IRC_PROTOCOL_CALLBACK(366) length += ((ptr_option) ? strlen (weechat_color (weechat_config_string (ptr_option))) : 0) + strlen (weechat_infolist_string (infolist, "prefix")) + - strlen (IRC_COLOR_CHAT) + + 16 + /* nick color */ strlen (weechat_infolist_string (infolist, "name")) + 1; } } @@ -3597,8 +3597,17 @@ IRC_PROTOCOL_CALLBACK(366) strcat (string, weechat_color (weechat_config_string (ptr_option))); strcat (string, prefix); } - strcat (string, IRC_COLOR_CHAT); - strcat (string, weechat_infolist_string (infolist, "name")); + nickname = weechat_infolist_string (infolist, "name"); + if (weechat_config_boolean (irc_config_look_color_nicks_in_names)) + { + if (weechat_strcasecmp (nickname, server->nick) == 0) + strcat (string, IRC_COLOR_CHAT_NICK_SELF); + else + strcat (string, irc_nick_find_color (nickname)); + } + else + strcat (string, IRC_COLOR_CHAT); + strcat (string, nickname); i++; } } |