diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-12 19:26:26 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-12 19:26:26 +0100 |
commit | 1c1ef05451cf3e2abd960faa45b53e0cc2d32c5c (patch) | |
tree | b66c016491c3b50593d1ddf69fecf8f745daa7f0 /src/plugins/irc/irc-nick.c | |
parent | 73476cc0f861f8dc160afc4021c38032d2a2c567 (diff) | |
download | weechat-1c1ef05451cf3e2abd960faa45b53e0cc2d32c5c.zip |
irc: use computed nick color in many messages instead of option weechat.color.chat_nick
Diffstat (limited to 'src/plugins/irc/irc-nick.c')
-rw-r--r-- | src/plugins/irc/irc-nick.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 98f3b80d1..249f98040 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -937,25 +937,47 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick, } /* - * irc_nick_color_for_server_message: return WeeChat color code for a nick - * (used in a server message) + * irc_nick_color_for_message: return WeeChat color code for a nick */ const char * -irc_nick_color_for_server_message (struct t_irc_nick *nick, - const char *nickname) +irc_nick_color_for_message (struct t_irc_server *server, + struct t_irc_nick *nick, + const char *nickname) { - if (weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) + if (nick) + return nick->color; + + if (nickname) { - if (nick) - return nick->color; - if (nickname) - return irc_nick_find_color (nickname); + if (server + && (irc_server_strcasecmp (server, nickname, server->nick) == 0)) + { + return IRC_COLOR_CHAT_NICK_SELF; + } + return irc_nick_find_color (nickname); } + return IRC_COLOR_CHAT_NICK; } /* + * irc_nick_color_for_server_message: return WeeChat color code for a nick + * (used in a server message) + */ + +const char * +irc_nick_color_for_server_message (struct t_irc_server *server, + struct t_irc_nick *nick, + const char *nickname) +{ + if (!weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) + return IRC_COLOR_CHAT_NICK; + + return irc_nick_color_for_message (server, nick, nickname); +} + +/* * irc_nick_color_for_pv: return string with color of nick for private */ |