Replaces wrongly named with

This commit is contained in:
David Cormier 2013-08-01 21:55:51 -04:00
parent 40d0145979
commit 1635f1df83
1 changed files with 14 additions and 14 deletions

View File

@ -105,7 +105,7 @@ weechat.factory('colors', [function($scope) {
}]); }]);
weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors) { weechat.factory('connection', ['$rootScope', 'colors', function($rootScope, colors) {
protocol = new Protocol(); protocol = new Protocol();
var websocket = null; var websocket = null;
@ -114,7 +114,7 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
msgs = message.replace(/[\r\n]+$/g, "").split("\n"); msgs = message.replace(/[\r\n]+$/g, "").split("\n");
for (var i = 0; i < msgs.length; i++) { for (var i = 0; i < msgs.length; i++) {
console.log('=' + msgs[i] + '='); console.log('=' + msgs[i] + '=');
$scope.commands.push("SENT: " + msgs[i]); $rootScope.commands.push("SENT: " + msgs[i]);
} }
websocket.send(message); websocket.send(message);
} }
@ -130,23 +130,23 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
} else { } else {
doSend("PASS " + password + "\r\nNICK test\r\nUSER test 0 * :test\r\n"); doSend("PASS " + password + "\r\nNICK test\r\nUSER test 0 * :test\r\n");
} }
$scope.connected = true; $rootScope.connected = true;
$scope.$apply(); $rootScope.$apply();
} }
websocket.onclose = function (evt) { websocket.onclose = function (evt) {
console.log("disconnected", "Disconnected"); console.log("disconnected", "Disconnected");
$scope.connected = false; $rootScope.connected = false;
} }
websocket.onmessage = function (evt) { websocket.onmessage = function (evt) {
protocol.setData(evt.data); protocol.setData(evt.data);
message = protocol.parse() message = protocol.parse()
console.log(message); console.log(message);
$scope.commands.push("RECV: " + evt.data + " TYPE:" + evt.type) ; $rootScope.commands.push("RECV: " + evt.data + " TYPE:" + evt.type) ;
parseMessage(message); parseMessage(message);
data = evt.data; data = evt.data;
$scope.$apply(); $rootScope.$apply();
} }
@ -192,7 +192,7 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
buffers[pointer] = content; buffers[pointer] = content;
} }
$scope.buffers = buffers; $rootScope.buffers = buffers;
} }
@ -202,21 +202,21 @@ weechat.factory('connection', ['$rootScope', 'colors', function($scope, colors)
var text = colors.parse(message['objects'][0]['content'][0]['message']); var text = colors.parse(message['objects'][0]['content'][0]['message']);
var buffer = message['objects'][0]['content'][0]['buffer']; var buffer = message['objects'][0]['content'][0]['buffer'];
var buffer_line = _.union(prefix, text); var buffer_line = _.union(prefix, text);
console.log('BUFFER: ', $scope.buffers[buffer]); console.log('BUFFER: ', $rootScope.buffers[buffer]);
$scope.buffers[buffer]['lines'].push(buffer_line); $rootScope.buffers[buffer]['lines'].push(buffer_line);
} }
var handleBufferOpened = function(message) { var handleBufferOpened = function(message) {
console.log('buffer opened'); console.log('buffer opened');
var fullName = message['objects'][0]['content'][0]['full_name'] var fullName = message['objects'][0]['content'][0]['full_name']
var buffer = message['objects'][0]['content'][0]['pointers'][0] var buffer = message['objects'][0]['content'][0]['pointers'][0]
$scope.buffers[buffer] = { 'lines':[], 'full_name':fullName } $rootScope.buffers[buffer] = { 'lines':[], 'full_name':fullName }
console.log($scope.buffers); console.log($rootScope.buffers);
} }
var sendMessage = function(message) { var sendMessage = function(message) {
message = "input " + $scope.activeBuffer['full_name'] + " " + message + "\n" message = "input " + $rootScope.activeBuffer['full_name'] + " " + message + "\n"
console.log($scope.activeBuffer); console.log($rootScope.activeBuffer);
doSend(message); doSend(message);
} }