mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 03:03:12 +02:00
irc: fix prefix color for nick when the prefix is not in irc.color.nick_prefixes: use default color (key "*")
Problem was happening on a server which has "PREFIX=(Yqaohv)!~&@%+". Users with prefix "!" were displayed as lightred (color for "~") instead of lightblue (default key "*"). When a prefix was not found, WeeChat was looping on other prefixes (in order). Now if color is not found, WeeChat uses immediately the fallback color.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.4.1-dev, 2013-03-17
|
||||
v0.4.1-dev, 2013-03-21
|
||||
|
||||
|
||||
This document lists all changes for each version.
|
||||
@@ -44,6 +44,8 @@ Version 0.4.1 (under dev!)
|
||||
list with arguments inside), guile >= 2.0 is now required (bug #38350)
|
||||
* guile: fix crash on calls to callbacks during load of script (bug #38343)
|
||||
* guile: fix compilation with guile 2.0
|
||||
* irc: fix prefix color for nick when the prefix is not in
|
||||
irc.color.nick_prefixes: use default color (key "*")
|
||||
* irc: add option irc.look.pv_buffer: automatically merge private buffers
|
||||
(optionally by server) (task #11924)
|
||||
* irc: rename option irc.network.lag_disconnect to irc.network.lag_reconnect,
|
||||
|
||||
+12
-16
@@ -430,34 +430,30 @@ irc_nick_get_prefix_color_name (struct t_irc_server *server, char prefix)
|
||||
static char *default_color = "";
|
||||
const char *prefix_modes, *color;
|
||||
char mode[2];
|
||||
int i, index;
|
||||
int index;
|
||||
|
||||
if (irc_config_hashtable_nick_prefixes)
|
||||
{
|
||||
mode[0] = ' ';
|
||||
mode[1] = '\0';
|
||||
|
||||
index = irc_server_get_prefix_char_index (server, prefix);
|
||||
if (index >= 0)
|
||||
{
|
||||
mode[0] = ' ';
|
||||
mode[1] = '\0';
|
||||
prefix_modes = irc_server_get_prefix_modes (server);
|
||||
for (i = index; prefix_modes[i]; i++)
|
||||
{
|
||||
mode[0] = prefix_modes[i];
|
||||
color = weechat_hashtable_get (irc_config_hashtable_nick_prefixes,
|
||||
mode);
|
||||
if (color)
|
||||
return color;
|
||||
}
|
||||
/*
|
||||
* no color found with mode (and following modes)?
|
||||
* => fallback to "*"
|
||||
*/
|
||||
mode[0] = '*';
|
||||
mode[0] = prefix_modes[index];
|
||||
color = weechat_hashtable_get (irc_config_hashtable_nick_prefixes,
|
||||
mode);
|
||||
if (color)
|
||||
return color;
|
||||
}
|
||||
|
||||
/* fallback to "*" if no color is found with mode */
|
||||
mode[0] = '*';
|
||||
color = weechat_hashtable_get (irc_config_hashtable_nick_prefixes,
|
||||
mode);
|
||||
if (color)
|
||||
return color;
|
||||
}
|
||||
|
||||
/* no color by default */
|
||||
|
||||
Reference in New Issue
Block a user