summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-config.c48
-rw-r--r--src/plugins/irc/irc-nick.h1
2 files changed, 49 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ec52f2af6..54b029c7c 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -31,6 +31,7 @@
#include "irc-config.h"
#include "irc-buffer.h"
#include "irc-ignore.h"
+#include "irc-nick.h"
#include "irc-server.h"
#include "irc-channel.h"
@@ -87,6 +88,8 @@ struct t_config_option *irc_config_network_send_unknown_commands;
struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS];
+struct t_hook *hook_config_color_nicks_number = NULL;
+
/*
* irc_config_search_server_option: search a server option name
@@ -140,6 +143,42 @@ irc_config_get_server_from_option_name (const char *name)
}
/*
+ * irc_config_change_look_color_nicks_number: called when the
+ * "weechat.look.color_nicks_number"
+ * option is changed
+ */
+
+int
+irc_config_change_look_color_nicks_number (void *data, const char *option,
+ const char *value)
+{
+ 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;
+ (void) value;
+
+ 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)
+ {
+ ptr_nick->color = irc_nick_find_color (ptr_nick);
+ }
+ }
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* irc_config_change_look_one_server_buffer: called when the "one server buffer"
* option is changed
*/
@@ -1285,6 +1324,9 @@ irc_config_init ()
irc_config_section_server = ptr_section;
+ hook_config_color_nicks_number = weechat_hook_config ("weechat.look.color_nicks_number",
+ &irc_config_change_look_color_nicks_number, NULL);
+
return 1;
}
@@ -1324,4 +1366,10 @@ void
irc_config_free ()
{
weechat_config_free (irc_config_file);
+
+ if (hook_config_color_nicks_number)
+ {
+ weechat_unhook (hook_config_color_nicks_number);
+ hook_config_color_nicks_number = NULL;
+ }
}
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index 34aebafa1..915fe221e 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -58,6 +58,7 @@ struct t_irc_nick
extern int irc_nick_valid (struct t_irc_channel *channel,
struct t_irc_nick *nick);
+extern const char *irc_nick_find_color (struct t_irc_nick *nick);
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nick_name, int is_chanowner,