--- a/mcabber/mcabber/commands.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/commands.c Tue Nov 01 18:00:39 2016 +0100
@@ -568,7 +568,6 @@
static void roster_buddylock(char *bjid, int lock)
{
gpointer bud = NULL;
- bool may_need_refresh = FALSE;
// Allow special jid "" or "." (current buddy)
if (bjid && (!*bjid || !strcmp(bjid, ".")))
@@ -588,7 +587,6 @@
bud = roster_elt->data;
else
scr_LogPrint(LPRINT_NORMAL, "This jid isn't in the roster.");
- may_need_refresh = TRUE;
}
} else {
// Use the current buddy
@@ -601,10 +599,8 @@
if (lock == -1)
lock = !(buddy_getflags(bud) & ROSTER_FLAG_USRLOCK);
buddy_setflags(bud, ROSTER_FLAG_USRLOCK, lock);
- if (may_need_refresh) {
- buddylist_defer_build();
- update_roster = TRUE;
- }
+ buddylist_defer_build();
+ scr_update_roster();
}
}
@@ -820,10 +816,8 @@
if (!strcasecmp(subcmd, "top")) {
scr_roster_top();
- update_roster = TRUE;
} else if (!strcasecmp(subcmd, "bottom")) {
scr_roster_bottom();
- update_roster = TRUE;
} else if (!strcasecmp(subcmd, "hide")) {
scr_roster_visibility(0);
} else if (!strcasecmp(subcmd, "show")) {
@@ -832,17 +826,13 @@
scr_roster_visibility(-1);
} else if (!strcasecmp(subcmd, "hide_offline")) {
buddylist_set_hide_offline_buddies(TRUE);
- if (current_buddy)
- buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
} else if (!strcasecmp(subcmd, "show_offline")) {
buddylist_set_hide_offline_buddies(FALSE);
- buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
} else if (!strcasecmp(subcmd, "toggle_offline")) {
buddylist_set_hide_offline_buddies(-1);
- buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
} else if (!strcasecmp(subcmd, "display")) {
scr_roster_display(arg);
} else if (!strcasecmp(subcmd, "item_lock")) {
@@ -867,7 +857,6 @@
return;
}
scr_roster_search(arg);
- update_roster = TRUE;
} else if (!strcasecmp(subcmd, "up")) {
roster_updown(-1, arg);
} else if (!strcasecmp(subcmd, "down")) {
@@ -913,13 +902,11 @@
if (status && !strcmp(status, "clear")) { // Not a color command, clear all
scr_roster_clear_color();
- update_roster = TRUE;
} else {
if (!status || !*status || !wildcard || !*wildcard || !color || !*color) {
scr_LogPrint(LPRINT_NORMAL, "Missing argument");
} else {
- update_roster = scr_roster_color(status, wildcard, color) ||
- update_roster;
+ scr_roster_color(status, wildcard, color);
}
}
free_arg_lst(arglist);
@@ -1258,7 +1245,7 @@
buddy_hide_group(group, group_state);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
do_group_return:
free_arg_lst(paramlst);
@@ -2227,7 +2214,7 @@
g_free(name_utf8);
g_free(newname);
- update_roster = TRUE;
+ scr_update_roster();
}
static void do_move(char *arg)
@@ -2296,7 +2283,7 @@
g_free(group_utf8);
g_free(newgroupname);
- update_roster = TRUE;
+ scr_update_roster();
}
static void list_option_cb(char *k, char *v, void *f)
@@ -2402,7 +2389,7 @@
assign = parse_assigment(arg, &alias, &value);
if (!alias) {
settings_foreach(SETTINGS_TYPE_ALIAS, &dump_alias, NULL);
- update_roster = TRUE;
+ scr_update_roster();
return;
}
if (!assign) { // This is a query
@@ -2628,7 +2615,7 @@
g_free(nick);
g_free(pass_utf8);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
free_arg_lst(paramlst);
}
@@ -2927,7 +2914,7 @@
roster_del_user(buddy_getjid(bud));
scr_update_buddy_window();
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
}
static void room_topic(gpointer bud, char *arg)
--- a/mcabber/mcabber/hooks.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/hooks.c Tue Nov 01 18:00:39 2016 +0100
@@ -436,7 +436,7 @@
(buddy_getstatus(roster_usr->data, NULL) == offline &&
buddylist_isset_filter()))
{
- update_roster = TRUE;
+ scr_update_roster();
}
g_free(bmsg);
@@ -568,7 +568,7 @@
roster_setstatus(bjid, rn, prio, status, status_msg, timestamp,
role_none, affil_none, NULL);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
hlog_write_status(bjid, timestamp, status, status_msg);
#ifdef MODULES_ENABLE
--- a/mcabber/mcabber/main.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/main.c Tue Nov 01 18:00:39 2016 +0100
@@ -563,8 +563,7 @@
sigwinch = FALSE;
}
#endif
- if (update_roster)
- scr_draw_roster();
+ scr_draw_roster();
scr_do_update();
}
--- a/mcabber/mcabber/roster.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/roster.c Tue Nov 01 18:00:39 2016 +0100
@@ -928,6 +928,7 @@
} else { // TRUE (hide -- andfo)
display_filter = DFILTER_ONLINE;
}
+ buddylist_defer_build();
}
int buddylist_isset_filter(void)
--- a/mcabber/mcabber/screen.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/screen.c Tue Nov 01 18:00:39 2016 +0100
@@ -156,7 +156,7 @@
static time_t chatstate_timestamp;
static guint chatstate_timeout_id = 0;
-int update_roster;
+int _update_roster;
int utf8_mode;
gboolean chatstates_disabled;
gboolean Autoaway;
@@ -382,6 +382,7 @@
}
g_slist_free(rostercolrules);
rostercolrules = NULL;
+ scr_update_roster();
}
// Adds, modifies or removes roster coloring rule
@@ -407,6 +408,7 @@
if (found) {
free_rostercolrule(found->data);
rostercolrules = g_slist_delete_link(rostercolrules, found);
+ scr_update_roster();
return TRUE;
} else {
scr_LogPrint(LPRINT_NORMAL, "No such color rule, nothing removed");
@@ -430,6 +432,7 @@
rc->color = cl;
rostercolrules = g_slist_prepend(rostercolrules, rc);
}
+ scr_update_roster();
return TRUE;
}
}
@@ -1405,7 +1408,7 @@
roster_msg_setflag(winId, special, FALSE);
if (!special)
roster_setflags(winId, ROSTER_FLAG_LOCK, TRUE);
- update_roster = TRUE;
+ scr_update_roster();
// Refresh the window
scr_update_window(win_entry);
@@ -1555,17 +1558,17 @@
if (!special) {
if (clearmsgflg) {
roster_msg_setflag(winId, FALSE, FALSE);
- update_roster = TRUE;
+ scr_update_roster();
} else if (setmsgflg) {
roster_msg_setflag(winId, FALSE, TRUE);
- update_roster = TRUE;
+ scr_update_roster();
}
}
}
static char *attention_sign_guard(const gchar *key, const gchar *new_value)
{
- update_roster = TRUE;
+ scr_update_roster();
if (g_strcmp0(settings_opt_get(key), new_value)) {
guint sign;
char *c;
@@ -1819,7 +1822,7 @@
}
// We'll need to redraw the roster
- update_roster = TRUE;
+ scr_update_roster();
return;
}
@@ -2086,7 +2089,9 @@
char space[2] = " ";
// We can reset update_roster
- update_roster = FALSE;
+ if (_update_roster == FALSE)
+ return;
+ _update_roster = FALSE;
buddylist_build();
@@ -2299,6 +2304,12 @@
curs_set(cursor_backup);
}
+void scr_update_roster(void)
+{
+ _update_roster = TRUE;
+}
+
+
// scr_roster_visibility(status)
// Set the roster visibility:
// status=1 Show roster
@@ -2538,10 +2549,11 @@
// Remove the readmark if it is at the end of the buffer
scr_buffer_readmark(-1);
}
- // We should rebuild the buddylist but not everytime
+ // We should rebuild the buddylist when the last selected buddy isn't
+ // displayed anymore
if (!(buddylist_get_filter() & 1<<prev_st))
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
}
// scr_roster_top()
@@ -2779,7 +2791,7 @@
status |= 1<<budstate;
buddylist_set_filter(status);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
return;
}
@@ -2967,7 +2979,7 @@
win_entry->bd->top = NULL;
}
- update_roster = TRUE;
+ scr_update_roster();
// Refresh the window
scr_update_buddy_window();
@@ -3320,7 +3332,7 @@
}
if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) {
roster_msg_setflag(bjid, special, TRUE);
- update_roster = TRUE;
+ scr_update_roster();
}
}
@@ -3357,7 +3369,7 @@
if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) {
roster_setuiprio(bjid, special, value, action);
- update_roster = TRUE;
+ scr_update_roster();
}
}
--- a/mcabber/mcabber/screen.h Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/screen.h Tue Nov 01 18:00:39 2016 +0100
@@ -57,7 +57,6 @@
int COLOR_ATTRIB[COLOR_max];
-extern int update_roster;
extern gboolean chatstates_disabled;
extern gboolean Autoaway;
@@ -110,6 +109,7 @@
void scr_resize(void);
void scr_draw_main_window(unsigned int fullinit);
void scr_draw_roster(void);
+void scr_update_roster(void);
void scr_update_main_status(int forceupdate);
void scr_update_chat_status(int forceupdate);
void scr_roster_visibility(int status);
--- a/mcabber/mcabber/xmpp.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/xmpp.c Tue Nov 01 18:00:39 2016 +0100
@@ -143,8 +143,7 @@
roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending, -1);
g_free(cleanjid);
buddylist_defer_build();
-
- update_roster = TRUE;
+ scr_update_roster();
}
void xmpp_updatebuddy(const char *bjid, const char *name, const char *group)
@@ -231,7 +230,7 @@
g_free(cleanjid);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
}
void xmpp_request(const char *fjid, enum iqreq_type reqtype)
@@ -877,7 +876,7 @@
// Reset carbons
carbons_reset();
// Update display
- update_roster = TRUE;
+ scr_update_roster();
scr_update_buddy_window();
if (!reason)
@@ -927,7 +926,7 @@
}
buddy_resource_setevents(sl_buddy->data, resource, xep85->last_state_rcvd);
- update_roster = TRUE;
+ scr_update_roster();
#endif
}
@@ -987,7 +986,7 @@
}
buddylist_defer_build();
- scr_draw_roster();
+ scr_update_roster();
goto gotmessage_return;
}
@@ -1694,7 +1693,7 @@
/* The subscription request has been denied or a previously-granted
subscription has been cancelled */
roster_unsubscribed(from);
- update_roster = TRUE;
+ scr_update_roster();
buf = g_strdup_printf("<%s> has cancelled your subscription to "
"their presence updates", from);
scr_WriteIncomingMessage(r, buf, 0, HBB_PREFIX_INFO, 0);
@@ -1706,7 +1705,7 @@
}
if (newbuddy)
- update_roster = TRUE;
+ scr_update_roster();
g_free(r);
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
@@ -2067,7 +2066,7 @@
// We'll have to update the roster if we switch to/from offline because
// we don't know the presences of buddies when offline...
if (mystatus == offline || st == offline)
- update_roster = TRUE;
+ scr_update_roster();
if (isonline || mystatus || st)
#ifdef WITH_DEPRECATED_STATUS_INVISIBLE
--- a/mcabber/mcabber/xmpp_iq.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/xmpp_iq.c Tue Nov 01 18:00:39 2016 +0100
@@ -669,7 +669,7 @@
}
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
if (need_refresh)
scr_update_buddy_window();
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
--- a/mcabber/mcabber/xmpp_iqrequest.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/xmpp_iqrequest.c Tue Nov 01 18:00:39 2016 +0100
@@ -671,7 +671,7 @@
g_free(bjid);
buddylist_defer_build();
- update_roster = TRUE;
+ scr_update_roster();
}
static LmHandlerResult cb_storage_bookmarks(LmMessageHandler *h,
--- a/mcabber/mcabber/xmpp_muc.c Tue Nov 01 08:39:07 2016 +0100
+++ b/mcabber/mcabber/xmpp_muc.c Tue Nov 01 18:00:39 2016 +0100
@@ -494,7 +494,7 @@
scr_WriteIncomingMessage(roomjid, msg, 0, HBB_PREFIX_INFO, 0);
// Send back an unavailable packet
xmpp_setstatus(offline, roomjid, "", TRUE);
- update_roster = TRUE;
+ scr_update_roster();
return;
}
@@ -627,7 +627,7 @@
buddy_del_all_resources(room_elt->data);
buddy_settopic(room_elt->data, NULL);
scr_update_chat_status(FALSE);
- update_roster = TRUE;
+ scr_update_roster();
}
// The message depends on _who_ left, and _how_
@@ -748,7 +748,7 @@
cmd_room_whois(room_elt->data, rname, FALSE);
}
- update_roster = TRUE;
+ scr_update_roster();
}
void roompresence(gpointer room, void *presencedata)