summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-02-24 12:15:05 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-02-24 12:15:05 +0100
commitbe9b4e59102e72b780574215360e37a9835a89cf (patch)
tree6c4d0400fda0c5617fcf2e2eea77d73214d2a664
parent87ace68b4d3fe928a1073f014a40ebc315797a71 (diff)
downloadweechat-be9b4e59102e72b780574215360e37a9835a89cf.zip
Refresh nicks colors in nicklist when changing option weechat.color.chat_nick_colors
-rw-r--r--src/plugins/irc/irc-config.c24
-rw-r--r--src/plugins/irc/irc-nick.c29
-rw-r--r--src/plugins/irc/irc-nick.h6
3 files changed, 35 insertions, 24 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ff8990a8f..7eadd3cf4 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -190,6 +190,10 @@ irc_config_compute_nick_colors ()
}
}
}
+
+ /* if colors are displayed for nicks in nicklist, refresh them */
+ if (weechat_config_boolean(irc_config_look_color_nicks_in_nicklist))
+ irc_nick_nicklist_set_color_all ();
}
/*
@@ -243,29 +247,11 @@ void
irc_config_change_look_color_nicks_in_nicklist (void *data,
struct t_config_option *option)
{
- struct t_irc_server *ptr_server;
- struct t_irc_channel *ptr_channel;
- struct t_irc_nick *ptr_nick;
-
/* make C compiler happy */
(void) data;
(void) option;
- for (ptr_server = irc_servers; ptr_server;
- ptr_server = ptr_server->next_server)
- {
- for (ptr_channel = ptr_server->channels; ptr_channel;
- ptr_channel = ptr_channel->next_channel)
- {
- for (ptr_nick = ptr_channel->nicks; ptr_nick;
- ptr_nick = ptr_nick->next_nick)
- {
- irc_nick_nicklist_set (ptr_channel, ptr_nick, "color",
- irc_nick_get_color_for_nicklist (ptr_server,
- ptr_nick));
- }
- }
- }
+ irc_nick_nicklist_set_color_all ();
}
/*
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 5419935f0..2dadbc9ae 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -517,6 +517,35 @@ irc_nick_nicklist_set (struct t_irc_channel *channel,
}
/*
+ * irc_nick_nicklist_set_color_all: set nick colors in nicklist for all
+ * servers/channels
+ */
+
+void
+irc_nick_nicklist_set_color_all ()
+{
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
+
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ for (ptr_nick = ptr_channel->nicks; ptr_nick;
+ ptr_nick = ptr_nick->next_nick)
+ {
+ irc_nick_nicklist_set (ptr_channel, ptr_nick, "color",
+ irc_nick_get_color_for_nicklist (ptr_server,
+ ptr_nick));
+ }
+ }
+ }
+}
+
+/*
* irc_nick_new: allocate a new nick for a channel and add it to the nick list
*/
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index 84cb61726..b5da137d1 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -58,11 +58,7 @@ extern int irc_nick_has_prefix_mode (struct t_irc_server *server,
extern int irc_nick_get_prefix_color (struct t_irc_server *server,
struct t_irc_nick *nick);
extern const char *irc_nick_get_prefix_color_name (int prefix_color);
-extern const char *irc_nick_get_color_for_nicklist (struct t_irc_server *server,
- struct t_irc_nick *nick);
-extern void irc_nick_nicklist_set (struct t_irc_channel *channel,
- struct t_irc_nick *nick,
- const char *property, const char *value);
+extern void irc_nick_nicklist_set_color_all ();
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nickname,