Moves event identification function in protocol

This commit is contained in:
David Cormier 2013-08-04 21:53:23 -04:00
parent f0012a8acb
commit 987a3b4933
2 changed files with 22 additions and 4 deletions

View file

@ -1,5 +1,23 @@
var Protocol = function() {
var self = this;
self.isEvent = function(receivedMessage) {
/*
* Determines whether or not the received message
* is an event.
*
* Right now, only the presence of an id is checked,
* as messages from the client don't specify the ID
*
* FIXME: check content of the id to dermine if message is an event
*/
if (receivedMessage['id']) {
return true;
} else {
return false;
}
}
var getInfo = function() {
var info = {};
info.key = getString();

View file

@ -206,12 +206,12 @@ weechat.factory('connection', ['$rootScope', '$http', 'handlers', 'colors', func
var parseMessage = function(message) {
if (!message['id']) {
// should only be in case of hda objects
parseObjects(message['objects']);
} else {
if (protocol.isEvent(message)) {
handlers.handleEvent(message);
} else {
parseObjects(message['objects']);
}
};