Merge pull request #569 from glowing-bear/improve-hotlist-clear
Improve hotlist clear
This commit is contained in:
commit
3d9228d901
4 changed files with 22 additions and 11 deletions
|
@ -258,6 +258,18 @@ weechat.factory('connection',
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var sendHotlistClear = function() {
|
||||||
|
if (parseInt(models.version.charAt(0)) >= 1) {
|
||||||
|
// WeeChat >= 1 supports clearing hotlist with this command
|
||||||
|
sendMessage('/buffer set hotlist -1');
|
||||||
|
} else {
|
||||||
|
// If user wants to sync hotlist with weechat
|
||||||
|
// we will send a /buffer bufferName command every time
|
||||||
|
// the user switches a buffer. This will ensure that notifications
|
||||||
|
// are cleared in the buffer the user switches to
|
||||||
|
sendCoreCommand('/buffer ' + models.getActiveBuffer().fullName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var requestNicklist = function(bufferId, callback) {
|
var requestNicklist = function(bufferId, callback) {
|
||||||
bufferId = bufferId || null;
|
bufferId = bufferId || null;
|
||||||
|
@ -334,6 +346,7 @@ weechat.factory('connection',
|
||||||
disconnect: disconnect,
|
disconnect: disconnect,
|
||||||
sendMessage: sendMessage,
|
sendMessage: sendMessage,
|
||||||
sendCoreCommand: sendCoreCommand,
|
sendCoreCommand: sendCoreCommand,
|
||||||
|
sendHotlistClear: sendHotlistClear,
|
||||||
fetchMoreLines: fetchMoreLines,
|
fetchMoreLines: fetchMoreLines,
|
||||||
requestNicklist: requestNicklist,
|
requestNicklist: requestNicklist,
|
||||||
attemptReconnect: attemptReconnect
|
attemptReconnect: attemptReconnect
|
||||||
|
|
|
@ -228,16 +228,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
|
|
||||||
// Do this part last since it's not important for the UI
|
// Do this part last since it's not important for the UI
|
||||||
if (settings.hotlistsync && ab.fullName) {
|
if (settings.hotlistsync && ab.fullName) {
|
||||||
if (parseInt(models.version.charAt(0)) >= 1) {
|
connection.sendHotlistClear();
|
||||||
// WeeChat >= 1 supports clearing hotlist with this command
|
|
||||||
connection.sendMessage('/buffer set hotlist -1');
|
|
||||||
} else {
|
|
||||||
// If user wants to sync hotlist with weechat
|
|
||||||
// we will send a /buffer bufferName command every time
|
|
||||||
// the user switches a buffer. This will ensure that notifications
|
|
||||||
// are cleared in the buffer the user switches to
|
|
||||||
connection.sendCoreCommand('/buffer ' + ab.fullName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -445,6 +436,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
if (utils.isMobileUi()) {
|
if (utils.isMobileUi()) {
|
||||||
$scope.hideSidebar();
|
$scope.hideSidebar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
return models.setActiveBuffer(bufferId, key);
|
return models.setActiveBuffer(bufferId, key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ var weechat = angular.module('weechat');
|
||||||
weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notifications', function($rootScope, $log, models, plugins, notifications) {
|
weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notifications', function($rootScope, $log, models, plugins, notifications) {
|
||||||
|
|
||||||
var handleVersionInfo = function(message) {
|
var handleVersionInfo = function(message) {
|
||||||
console.log(message.objects[0]);
|
|
||||||
var content = message.objects[0].content;
|
var content = message.objects[0].content;
|
||||||
var version = content.value;
|
var version = content.value;
|
||||||
// Store the WeeChat version in models
|
// Store the WeeChat version in models
|
||||||
|
|
|
@ -104,6 +104,9 @@ weechat.directive('inputBar', function() {
|
||||||
$scope.command = '';
|
$scope.command = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Presumable we are reading the messages if we are sending.
|
||||||
|
connection.sendHotlistClear();
|
||||||
|
|
||||||
$scope.getInputNode().focus();
|
$scope.getInputNode().focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue