summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-04 10:32:56 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-04 10:32:56 +0200
commit58c32e4249c3c462e8e12ae7d2f428fbf73b5b21 (patch)
tree9803a8472bad08227c52d3ab143cd756abbc5353 /src/plugins/irc
parent9206036233dbfa2dc8ef6d6cd6f43e1bab560e79 (diff)
downloadweechat-58c32e4249c3c462e8e12ae7d2f428fbf73b5b21.zip
irc: fix display of items "away" and "lag" in root bars, refresh all irc bar items on signal "buffer_switch" (bug #34466)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-bar-item.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 99a190cc1..42fc5abd3 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -54,6 +54,9 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
buf = NULL;
+ if (!window)
+ window = weechat_current_window ();
+
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
@@ -387,6 +390,9 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
(void) data;
(void) item;
+ if (!window)
+ window = weechat_current_window ();
+
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
@@ -539,6 +545,31 @@ irc_bar_item_focus_buffer_nicklist (void *data,
}
/*
+ * irc_bar_item_buffer_switch: called on "buffer_switch" signal: refresh irc
+ * bar items (for root bars)
+ */
+
+int
+irc_bar_item_buffer_switch (void *data, const char *signal,
+ const char *type_data, void *signal_data)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) signal;
+ (void) type_data;
+ (void) signal_data;
+
+ weechat_bar_item_update ("away");
+ weechat_bar_item_update ("buffer_title");
+ weechat_bar_item_update ("buffer_name");
+ weechat_bar_item_update ("irc_channel");
+ weechat_bar_item_update ("lag");
+ weechat_bar_item_update ("input_prompt");
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* irc_bar_item_init: initialize IRC bar items
*/
@@ -554,4 +585,6 @@ irc_bar_item_init ()
weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL);
weechat_hook_focus ("buffer_nicklist",
&irc_bar_item_focus_buffer_nicklist, NULL);
+ weechat_hook_signal ("buffer_switch",
+ &irc_bar_item_buffer_switch, NULL);
}