Moves event identification function in protocol
This commit is contained in:
parent
f0012a8acb
commit
987a3b4933
|
@ -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();
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue