Group all messaging commands

This commit is contained in:
David Cormier 2013-10-27 12:13:10 -04:00
parent 8167b25c36
commit 75e8c87f09
1 changed files with 12 additions and 16 deletions

View File

@ -206,6 +206,18 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers',
return defer; return defer;
} }
/*
* Fails every currently subscribed callback for the
* given reason
* @param reason reason for failure
*/
failCallbacks = function(reason) {
for(i in callbacks) {
callbacks[i].cb.reject(reason);
}
}
var send = function(message) { var send = function(message) {
message.replace(/[\r\n]+$/g, "").split("\n"); message.replace(/[\r\n]+$/g, "").split("\n");
var cb = createCallback(message); var cb = createCallback(message);
@ -213,7 +225,6 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers',
return cb.promise; return cb.promise;
} }
/* /*
* Send all messages to the websocket and returns a promise that is resolved * Send all messages to the websocket and returns a promise that is resolved
* when all message are resolved. * when all message are resolved.
@ -310,21 +321,6 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers',
} }
); );
}
/*
* Fails every currently subscribed callback for the
* given reason
* @param reason reason for failure
*/
failCallbacks = function(reason) {
for(i in callbacks) {
callbacks[i].cb.reject(reason);
}
} }
websocket.onclose = function (evt) { websocket.onclose = function (evt) {