handlers: check for active buffer

Check for active buffer before syncing unreads from WeeChat
This commit is contained in:
Tor Hveem 2016-07-30 14:08:06 +02:00
parent afe03fd9ea
commit f4257c35c3
No known key found for this signature in database
GPG Key ID: 7C3ECF7851B7F195
1 changed files with 7 additions and 1 deletions

View File

@ -306,7 +306,7 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
var handleBufferTypeChanged = function(message) {
var obj = message.objects[0].content[0];
var buffer = obj.pointers[0];
var old = models.getBuffer(buffer);
//var old = models.getBuffer(buffer);
// 0 = formatted (normal); 1 = free
buffer.bufferType = obj.type;
};
@ -350,6 +350,12 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
var hotlist = message.objects[0].content;
hotlist.forEach(function(l) {
var buffer = models.getBuffer(l.buffer);
// If buffer is active in gb, but not active in WeeChat the
// hotlist in WeeChat will increase but we should ignore that
// in gb.
if (buffer.active) {
return;
}
// 1 is message
buffer.unread = l.count[1];
// 2 is private