Handle _buffer_closed event
This commit is contained in:
parent
38a960788c
commit
4743d3d15a
|
@ -167,6 +167,11 @@ weechat.factory('urlPlugin', [function() {
|
|||
|
||||
weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($rootScope, colors, pluginManager) {
|
||||
|
||||
var handleBufferClosing = function(message) {
|
||||
var buffer_pointer = message['objects'][0]['content'][0]['pointers'][0];
|
||||
$rootScope.closeBuffer(buffer_pointer);
|
||||
}
|
||||
|
||||
var handleBufferLineAdded = function(message) {
|
||||
var buffer_line = {}
|
||||
var prefix = colors.parse(message['objects'][0]['content'][0]['prefix']);
|
||||
|
@ -249,6 +254,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
|
|||
|
||||
var eventHandlers = {
|
||||
bufinfo: handleBufferInfo,
|
||||
_buffer_closing: handleBufferClosing,
|
||||
_buffer_line_added: handleBufferLineAdded,
|
||||
_buffer_opened: handleBufferOpened
|
||||
}
|
||||
|
@ -338,6 +344,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', 'connection', functio
|
|||
$scope.proto = "weechat"
|
||||
$scope.password = ""
|
||||
|
||||
|
||||
$rootScope.closeBuffer = function(buffer_pointer) {
|
||||
delete($rootScope.buffers[buffer_pointer]);
|
||||
var first_buffer = _.keys($rootScope.buffers)[0];
|
||||
$scope.setActiveBuffer(first_buffer);
|
||||
}
|
||||
|
||||
$scope.setActiveBuffer = function(key) {
|
||||
$rootScope.buffers[key]['notification'] = false;
|
||||
$rootScope.activeBuffer = $rootScope.buffers[key];
|
||||
|
|
Loading…
Reference in New Issue