# HG changeset patch # User Mikael Berthe # Date 1481664405 -3600 # Node ID ece02eb9c81d84a9c3e5bdad95b3ec44e812f0f9 # Parent 1f5f708d58a60e3027d4108f51f0c017bb9bc8f9 Backed out changeset 1bb9002801e5 diff -r 1f5f708d58a6 -r ece02eb9c81d mcabber/mcabber/hooks.c --- a/mcabber/mcabber/hooks.c Mon Nov 21 20:58:58 2016 +0100 +++ b/mcabber/mcabber/hooks.c Tue Dec 13 22:26:45 2016 +0100 @@ -44,8 +44,6 @@ guint hid; } hook_list_data_t; -extern int build_buddylist; - static GHashTable *hk_handler_hash = NULL; // _new_hook_id() @@ -569,7 +567,8 @@ roster_setstatus(bjid, rn, prio, status, status_msg, timestamp, role_none, affil_none, NULL); - build_buddylist = TRUE; + buddylist_build(); + update_roster = TRUE; hlog_write_status(bjid, timestamp, status, status_msg); #ifdef MODULES_ENABLE diff -r 1f5f708d58a6 -r ece02eb9c81d mcabber/mcabber/main.c --- a/mcabber/mcabber/main.c Mon Nov 21 20:58:58 2016 +0100 +++ b/mcabber/mcabber/main.c Tue Dec 13 22:26:45 2016 +0100 @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "caps.h" @@ -67,11 +66,8 @@ static bool sigwinch; #endif -extern int build_buddylist; - static bool terminate_ui; GMainContext *main_context; -static guint refresh_timeout_id; static struct termios *backup_termios; @@ -381,13 +377,6 @@ return keyboard_activity(); } -static gboolean refresh_timeout_cb(gpointer data) { - // Only called once, to trigger a refresh if needed - // so reset ID and return false. - refresh_timeout_id = 0; - return FALSE; -} - static GSourceFuncs mcabber_source_funcs = { mcabber_source_prepare, mcabber_source_check, @@ -494,10 +483,6 @@ } } - /* Initialize buddylist update timestamp */ - struct timespec last_ui_update; - clock_gettime(CLOCK_MONOTONIC, &last_ui_update); - /* Initialize PGP system We do it before ncurses initialization because we may need to request a passphrase. */ @@ -570,9 +555,6 @@ scr_LogPrint(LPRINT_DEBUG, "Entering into main loop..."); while(!terminate_ui) { - int64_t timediff; - struct timespec now; - if (g_main_context_iteration(main_context, TRUE) == FALSE) keyboard_activity(); #ifdef USE_SIGWINCH @@ -581,36 +563,9 @@ sigwinch = FALSE; } #endif - - // Compute time in ms since last buddylist/screen update - clock_gettime(CLOCK_MONOTONIC, &now); - timediff = (((now.tv_sec - last_ui_update.tv_sec) * 1.0e9) + - (now.tv_nsec - last_ui_update.tv_nsec)) / 1.0e6; - - if (timediff <= 200) { - // Trigger a timeout in 1s to make sure no refresh will be missed - if (!refresh_timeout_id) { - refresh_timeout_id = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, - 1, refresh_timeout_cb, NULL, NULL); - } - } else if ((build_buddylist || update_roster)) { - // More than 200ms - if (build_buddylist || update_roster) { - if (build_buddylist) { - buddylist_build(); - update_roster = TRUE; - } - if (update_roster) { - scr_draw_roster(); - scr_do_update(); - last_ui_update = now; - } - } else { - // No roster change; minimum screen update - update_panels(); - doupdate(); - } - } + if (update_roster) + scr_draw_roster(); + scr_do_update(); } g_source_destroy(mc_source); diff -r 1f5f708d58a6 -r ece02eb9c81d mcabber/mcabber/roster.c --- a/mcabber/mcabber/roster.c Mon Nov 21 20:58:58 2016 +0100 +++ b/mcabber/mcabber/roster.c Tue Dec 13 22:26:45 2016 +0100 @@ -23,8 +23,6 @@ #include "utils.h" #include "hooks.h" -int build_buddylist; - extern void hlog_save_state(void); char *strrole[] = { /* Should match enum in roster.h */ @@ -1034,8 +1032,6 @@ // current_buddy initialization if (!current_buddy || (g_list_position(buddylist, current_buddy) == -1)) current_buddy = g_list_first(buddylist); - - build_buddylist = FALSE; } // buddy_hide_group(roster, hide) diff -r 1f5f708d58a6 -r ece02eb9c81d mcabber/mcabber/screen.c --- a/mcabber/mcabber/screen.c Mon Nov 21 20:58:58 2016 +0100 +++ b/mcabber/mcabber/screen.c Tue Dec 13 22:26:45 2016 +0100 @@ -68,8 +68,6 @@ #define DEFAULT_ATTENTION_CHAR '!' -extern int build_buddylist; - const char *LocaleCharSet = "C"; static unsigned short int Log_Win_Height; @@ -2540,7 +2538,7 @@ } // We should rebuild the buddylist but not everytime if (!(buddylist_get_filter() & 1<