Handles buffer opened
_buffer_opened signal sent by the relay will open a buffer in the webpage
This commit is contained in:
parent
a2e43c8695
commit
5af244737e
|
@ -159,13 +159,14 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
|
||||||
|
|
||||||
var parseMessage = function(message) {
|
var parseMessage = function(message) {
|
||||||
|
|
||||||
if (message['id'] == '_buffer_line_added') {
|
|
||||||
types[message['id']](message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!message['id']) {
|
if (!message['id']) {
|
||||||
// should only be in case of hda objects
|
// should only be in case of hda objects
|
||||||
parseObjects(message['objects']);
|
parseObjects(message['objects']);
|
||||||
|
} else {
|
||||||
|
types[message['id']](message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,13 +206,20 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
|
||||||
$scope.buffers[buffer]['lines'].push(buffer_line);
|
$scope.buffers[buffer]['lines'].push(buffer_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var handleBufferOpened = function(message) {
|
||||||
|
var fullName = message['objects'][0]['content'][0]['full_name']
|
||||||
|
var buffer = message['objects'][0]['content'][0]['pointers'][0]
|
||||||
|
$scope.buffers[buffer] = { 'lines':[], 'full_name':fullName }
|
||||||
|
console.log($scope.buffers);
|
||||||
|
}
|
||||||
var sendMessage = function(message) {
|
var sendMessage = function(message) {
|
||||||
message = "input " + $scope.activeBuffer['full_name'] + " " + message + "\n"
|
message = "input " + $scope.activeBuffer['full_name'] + " " + message + "\n"
|
||||||
doSend(message);
|
doSend(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
var types = {
|
var types = {
|
||||||
_buffer_line_added: handleBufferLineAdded
|
_buffer_line_added: handleBufferLineAdded,
|
||||||
|
_buffer_opened: handleBufferOpened
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue