diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-02-26 18:18:37 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-02-26 18:18:37 +0100 |
commit | f3dc2e7ef91aa258f9cd39e0ea258f6ec08a97ca (patch) | |
tree | a7ccab6fa6b374df105da517042ff328a48bc922 /src/plugins/irc/irc-nick.c | |
parent | a1e87fe63d8c5aa49619080a1947384711eaafcd (diff) | |
download | weechat-f3dc2e7ef91aa258f9cd39e0ea258f6ec08a97ca.zip |
irc: add search for lower case nicks in option irc.look.nick_color_force
Diffstat (limited to 'src/plugins/irc/irc-nick.c')
-rw-r--r-- | src/plugins/irc/irc-nick.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index a360ee117..fbcb944fe 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -160,6 +160,37 @@ irc_nick_hash_color (const char *nickname) } /* + * irc_nick_get_forced_color: get forced color for a nick + * (NULL if no color is forced for nick) + */ + +const char * +irc_nick_get_forced_color (const char *nickname) +{ + const char *forced_color; + char *nick_lower; + + if (!nickname) + return NULL; + + forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force, + nickname); + if (forced_color) + return forced_color; + + nick_lower = strdup (nickname); + if (nick_lower) + { + weechat_string_tolower (nick_lower); + forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force, + nick_lower); + free (nick_lower); + } + + return forced_color; +} + +/* * irc_nick_find_color: find a color code for a nick * (according to nick letters) */ @@ -178,8 +209,7 @@ irc_nick_find_color (const char *nickname) return weechat_color ("default"); /* look if color is forced */ - forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force, - nickname); + forced_color = irc_nick_get_forced_color (nickname); if (forced_color) { forced_color = weechat_color (forced_color); @@ -218,8 +248,7 @@ irc_nick_find_color_name (const char *nickname) return default_color; /* look if color is forced */ - forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force, - nickname); + forced_color = irc_nick_get_forced_color (nickname); if (forced_color) return forced_color; |