summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-buffer.c1
-rw-r--r--src/plugins/irc/irc-server.c44
-rw-r--r--src/plugins/irc/irc-server.h1
3 files changed, 45 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index 08ddfd96f..86640f603 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -215,6 +215,7 @@ irc_buffer_merge_servers ()
}
irc_server_set_buffer_title (irc_current_server);
+ irc_server_buffer_set_highlight_words (irc_buffer_servers);
}
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 993235d77..1815e82f4 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -211,6 +211,44 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
}
/*
+ * irc_server_buffer_set_highlight_words: set highlight words for buffer with
+ * all servers
+ */
+
+void
+irc_server_buffer_set_highlight_words (struct t_gui_buffer *buffer)
+{
+ struct t_irc_server *ptr_server;
+ int length;
+ char *words;
+
+ length = 0;
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ if (ptr_server->is_connected && ptr_server->nick)
+ length += strlen (ptr_server->nick) + 1;
+ }
+ words = malloc (length + 1);
+ if (words)
+ {
+ words[0] = '\0';
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ if (ptr_server->is_connected && ptr_server->nick)
+ {
+ if (words[0])
+ strcat (words, ",");
+ strcat (words, ptr_server->nick);
+ }
+ }
+ weechat_buffer_set (buffer, "highlight_words", words);
+ free (words);
+ }
+}
+
+/*
* irc_server_set_nick: set nickname for a server
*/
@@ -223,13 +261,17 @@ irc_server_set_nick (struct t_irc_server *server, const char *nick)
free (server->nick);
server->nick = (nick) ? strdup (nick) : NULL;
- weechat_buffer_set (server->buffer, "highlight_words", nick);
+ if (weechat_config_boolean (irc_config_look_one_server_buffer))
+ irc_server_buffer_set_highlight_words (server->buffer);
+ else
+ weechat_buffer_set (server->buffer, "highlight_words", nick);
/* set local variable "nick" for server and all channels/pv */
weechat_buffer_set (server->buffer, "localvar_set_nick", nick);
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
+ weechat_buffer_set (ptr_channel->buffer, "highlight_words", server->nick);
weechat_buffer_set (ptr_channel->buffer, "localvar_set_nick", nick);
}
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index eb89f21d1..3f2a92a17 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -177,6 +177,7 @@ extern char *irc_server_get_name_without_port (const char *name);
extern void irc_server_set_addresses (struct t_irc_server *server,
const char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
+extern void irc_server_buffer_set_highlight_words (struct t_gui_buffer *buffer);
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
extern struct t_irc_server *irc_server_alloc (const char *name);
extern int irc_server_alloc_with_url (const char *irc_url);