Handle _buffer_localvar_{add,remov}ed events

fixes indendation of newly opened buffers
This commit is contained in:
Lorenz Hübschle-Schneider 2014-05-09 17:36:35 +01:00
parent afc3aa169f
commit 6b99efb4ac
1 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,18 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', function
old.shortName = obj.short_name;
};
var handleBufferLocalvarChanged = function(message) {
var obj = message.objects[0].content[0];
var buffer = obj.pointers[0];
var old = models.getBuffer(buffer);
var localvars = obj.local_variables;
if (old !== undefined && localvars !== undefined) {
// Update indendation status
old.indent = (['channel', 'private'].indexOf(localvars.type) >= 0);
}
};
/*
* Handle answers to (lineinfo) messages
*
@ -195,6 +207,8 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', function
var eventHandlers = {
_buffer_closing: handleBufferClosing,
_buffer_line_added: handleBufferLineAdded,
_buffer_localvar_added: handleBufferLocalvarChanged,
_buffer_localvar_removed: handleBufferLocalvarChanged,
_buffer_opened: handleBufferOpened,
_buffer_title_changed: handleBufferTitleChanged,
_buffer_renamed: handleBufferRenamed,