From d0cabde132275743b09e3c142bd127bcddd1a595 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Sat, 18 Apr 2015 12:06:02 +0200 Subject: [PATCH 1/2] Send more types of clearing only when using new style --- js/glowingbear.js | 6 +++++- js/inputbar.js | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 9660570..8e2d642 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -445,7 +445,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // Clear the hotlist for this buffer, because presumable you have read // the messages in this buffer before you switched to the new one - connection.sendHotlistClear(); + // this is only needed with new type of clearing since in the old + // way WeeChat itself takes care of that part + if (parseInt(models.version.charAt(0)) >= 1) { + connection.sendHotlistClear(); + } return models.setActiveBuffer(bufferId, key); }; diff --git a/js/inputbar.js b/js/inputbar.js index c0ec77e..4540bff 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -104,8 +104,10 @@ weechat.directive('inputBar', function() { $scope.command = ''; } - // Presumable we are reading the messages if we are sending. - connection.sendHotlistClear(); + // New style clearing requires this, old does not + if (parseInt(models.version.charAt(0)) >= 1) { + connection.sendHotlistClear(); + } $scope.getInputNode().focus(); }; From 2fa229851b4d7c4c7c058511b95e5e9d489c487c Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Sat, 18 Apr 2015 12:10:49 +0200 Subject: [PATCH 2/2] Move readmarker too when using new style --- js/connection.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/connection.js b/js/connection.js index 9c5f649..9f9b345 100644 --- a/js/connection.js +++ b/js/connection.js @@ -270,6 +270,8 @@ weechat.factory('connection', if (parseInt(models.version.charAt(0)) >= 1) { // WeeChat >= 1 supports clearing hotlist with this command sendMessage('/buffer set hotlist -1'); + // Also move read marker + sendMessage('/input set_unread_current_buffer'); } else { // If user wants to sync hotlist with weechat // we will send a /buffer bufferName command every time