summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-04-23 17:23:17 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-04-23 17:23:17 +0200
commit70b0f12469560534fdb87b7c534495efb7079e69 (patch)
treec41bd9c9be9ffbaf536b9323be17d1fde96a32ce /src/gui
parent909fe8a2b5a751dd6a30768609c535594a745a58 (diff)
downloadweechat-70b0f12469560534fdb87b7c534495efb7079e69.zip
core: add buffer to hotlist if away is set on buffer (even if buffer is displayed) (task #10948), do not update hotlist during upgrade
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-chat.c1
-rw-r--r--src/gui/curses/gui-curses-main.c2
-rw-r--r--src/gui/curses/gui-curses-window.c3
-rw-r--r--src/gui/gui-buffer.c2
-rw-r--r--src/gui/gui-hotlist.c17
-rw-r--r--src/gui/gui-hotlist.h3
-rw-r--r--src/gui/gui-input.c1
-rw-r--r--src/gui/gui-line.c4
8 files changed, 20 insertions, 13 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 13508be85..f1f28919f 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -1130,7 +1130,6 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
{
ptr_win->scroll->start_line = NULL;
ptr_win->scroll->start_line_pos = 0;
- gui_hotlist_remove_buffer (ptr_win->buffer);
}
/* cursor is below end line of chat window? */
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 550449f8c..bc91c32e1 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -127,6 +127,8 @@ gui_main_init ()
{
gui_init_ok = 1;
+ ptr_buffer->num_displayed = 1;
+
/* set title for core buffer */
gui_buffer_set_title (ptr_buffer,
"WeeChat " PACKAGE_VERSION " "
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 0c229ef91..7ea0a3585 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -1040,7 +1040,8 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
window->buffer = buffer;
gui_buffer_add_value_num_displayed (buffer, 1);
- gui_hotlist_remove_buffer (buffer);
+ if (!weechat_upgrading && (old_buffer != buffer))
+ gui_hotlist_remove_buffer (buffer);
if (gui_ok)
{
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 162e1e62b..4a4fc674c 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -1346,7 +1346,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
- (void) gui_hotlist_add (buffer, number, NULL, 1);
+ (void) gui_hotlist_add (buffer, number, NULL);
}
}
diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c
index 953e3ddd2..d15d84df0 100644
--- a/src/gui/gui-hotlist.c
+++ b/src/gui/gui-hotlist.c
@@ -31,6 +31,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
+#include "../core/wee-hashtable.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@@ -282,21 +283,22 @@ gui_hotlist_add_hotlist (struct t_gui_hotlist **hotlist,
struct t_gui_hotlist *
gui_hotlist_add (struct t_gui_buffer *buffer,
enum t_gui_hotlist_priority priority,
- struct timeval *creation_time, int allow_current_buffer)
+ struct timeval *creation_time)
{
struct t_gui_hotlist *new_hotlist, *ptr_hotlist;
int i, count[GUI_HOTLIST_NUM_PRIORITIES];
+ const char *away;
if (!buffer || !gui_add_hotlist)
return NULL;
- /* do not add current buffer */
- if ((buffer == gui_current_window->buffer)
- && (!allow_current_buffer || (!gui_buffer_is_scrolled (buffer))))
+ /* do not add core buffer if upgrading */
+ if (weechat_upgrading && (buffer == gui_buffer_search_main ()))
return NULL;
- /* do not add buffer if it is displayed in a window */
- if (buffer->num_displayed > 0)
+ /* do not add buffer if it is displayed and away is not set */
+ away = hashtable_get (buffer->local_variables, "away");
+ if ((buffer->num_displayed > 0) && (!away || !away[0]))
return NULL;
if (priority > GUI_HOTLIST_MAX)
@@ -431,6 +433,9 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer)
int hotlist_changed;
struct t_gui_hotlist *ptr_hotlist, *next_hotlist;
+ if (weechat_upgrading)
+ return;
+
hotlist_changed = 0;
ptr_hotlist = gui_hotlist;
diff --git a/src/gui/gui-hotlist.h b/src/gui/gui-hotlist.h
index 69ac2aed3..c4a2ce206 100644
--- a/src/gui/gui-hotlist.h
+++ b/src/gui/gui-hotlist.h
@@ -55,8 +55,7 @@ extern int gui_add_hotlist;
extern struct t_gui_hotlist *gui_hotlist_add (struct t_gui_buffer *buffer,
enum t_gui_hotlist_priority priority,
- struct timeval *creation_time,
- int allow_current_buffer);
+ struct timeval *creation_time);
extern void gui_hotlist_resort ();
extern void gui_hotlist_clear ();
extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer);
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 2a3326468..86aa6b4c2 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -1173,6 +1173,7 @@ gui_input_jump_smart (struct t_gui_buffer *buffer)
if (!gui_hotlist_initial_buffer)
gui_hotlist_initial_buffer = window->buffer;
gui_window_switch_to_buffer (window, gui_hotlist->buffer, 1);
+ gui_hotlist_remove_buffer (window->buffer);
gui_window_scroll_bottom (window);
}
else
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 9f020b620..173980dda 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -848,7 +848,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
{
if (new_line->data->highlight)
{
- (void) gui_hotlist_add (buffer, GUI_HOTLIST_HIGHLIGHT, NULL, 1);
+ (void) gui_hotlist_add (buffer, GUI_HOTLIST_HIGHLIGHT, NULL);
if (!weechat_upgrading)
{
message_for_signal = gui_chat_build_string_prefix_message (new_line);
@@ -875,7 +875,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
}
}
if (notify_level >= GUI_HOTLIST_MIN)
- (void) gui_hotlist_add (buffer, notify_level, NULL, 1);
+ (void) gui_hotlist_add (buffer, notify_level, NULL);
}
}
else