mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 08:13:14 +02:00
core: add buffer to hotlist if away is set on buffer (even if buffer is displayed) (task #10948), do not update hotlist during upgrade
This commit is contained in:
@@ -7,6 +7,9 @@ v0.3.5-rc1, 2011-04-23
|
||||
Version 0.3.5 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: add buffer to hotlist if away is set on buffer (even if buffer is
|
||||
displayed) (task #10948)
|
||||
* core: do not update hotlist during upgrade
|
||||
* core: add option "balance" for command /window (key: alt+"w" + alt+"b")
|
||||
* core: add option "swap" for command /window (key: alt+"w" + alt+"s")
|
||||
(task #11001)
|
||||
|
||||
@@ -566,8 +566,7 @@ upgrade_weechat_read_cb (void *data,
|
||||
memcpy (&creation_time, buf, size);
|
||||
new_hotlist = gui_hotlist_add (ptr_buffer,
|
||||
infolist_integer (infolist, "priority"),
|
||||
&creation_time,
|
||||
1);
|
||||
&creation_time);
|
||||
if (new_hotlist)
|
||||
{
|
||||
for (i = 0; i < GUI_HOTLIST_NUM_PRIORITIES; i++)
|
||||
|
||||
@@ -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? */
|
||||
|
||||
@@ -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 " "
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-6
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user