diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-01-11 15:01:53 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-01-11 15:01:53 +0100 |
commit | 0ad7b2f6bd4f7a30cb9b1ad9d7c1114a02525c10 (patch) | |
tree | 3760bf38fcd2d36c90af11a6208842a1f1b6b341 /src/plugins/irc/irc-nick.c | |
parent | 95c2cb1c5b6b53f95b8b6b3bdcddfd6233bf078a (diff) | |
download | weechat-0ad7b2f6bd4f7a30cb9b1ad9d7c1114a02525c10.zip |
Fix IRC nick color for nicks with wide chars (bug #28547)
Diffstat (limited to 'src/plugins/irc/irc-nick.c')
-rw-r--r-- | src/plugins/irc/irc-nick.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index e47463dfe..cd3aeb34a 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -63,17 +63,20 @@ irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick) const char * irc_nick_find_color (const char *nickname) { - int i, color; + int color; char color_name[64]; + const char *ptr_nick; color = 0; - for (i = strlen (nickname) - 1; i >= 0; i--) + ptr_nick = nickname; + while (ptr_nick && ptr_nick[0]) { - color += (int)(nickname[i]); + color += weechat_utf8_char_int (ptr_nick); + ptr_nick = weechat_utf8_next_char (ptr_nick); } color = (color % weechat_config_integer (weechat_config_get ("weechat.look.color_nicks_number"))); - + snprintf (color_name, sizeof (color_name), "chat_nick_color%02d", color + 1); |