From 352210df52245ef8cae0b960a42b6b61c3a261a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 5 Nov 2018 17:20:37 +0100 Subject: [PATCH] Disable periodic hotlist sync if read status sync is disabled This will cause weechat and Glowing Bear read status to drift apart but that's how it used to be before we added the periodic sync anyway, and properly fixing it would require maintaining *tons* of state, so that's life. --- js/connection.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/js/connection.js b/js/connection.js index 6cbcb39..3f0933d 100644 --- a/js/connection.js +++ b/js/connection.js @@ -4,10 +4,11 @@ var weechat = angular.module('weechat'); weechat.factory('connection', - ['$rootScope', '$log', 'handlers', 'models', 'ngWebsockets', function($rootScope, + ['$rootScope', '$log', 'handlers', 'models', 'settings', 'ngWebsockets', function($rootScope, $log, handlers, models, + settings, ngWebsockets) { var protocol = new weeChat.Protocol(); @@ -194,17 +195,19 @@ weechat.factory('connection', handlers.handleHotlistInfo(hotlist); }); - // Schedule hotlist syncing every so often so that this - // client will have unread counts (mostly) in sync with - // other clients or terminal usage directly. - setInterval(function() { - if ($rootScope.connected) { - _requestHotlist().then(function(hotlist) { - handlers.handleHotlistInfo(hotlist); - - }); - } - }, 60000); // Sync hotlist every 60 second + if (settings.hotlistsync) { + // Schedule hotlist syncing every so often so that this + // client will have unread counts (mostly) in sync with + // other clients or terminal usage directly. + setInterval(function() { + if ($rootScope.connected) { + _requestHotlist().then(function(hotlist) { + handlers.handleHotlistInfo(hotlist); + + }); + } + }, 60000); // Sync hotlist every 60 second + } // Fetch weechat time format for displaying timestamps