diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filter.js | 6 | ||||
-rw-r--r-- | lib/providermanager.js | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/filter.js b/lib/filter.js index 079c25049..8c7dc6e33 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -47,8 +47,10 @@ Filter.prototype.changed = function(callback) { /// trigger calling new message from people Filter.prototype.trigger = function(messages) { - for(var i = 0; i < this.callbacks.length; i++) { - this.callbacks[i].call(this, messages); + for (var i = 0; i < this.callbacks.length; i++) { + for (var j = 0; j < messages; j++) { + this.callbacks[i].call(this, messages[j]); + } } }; diff --git a/lib/providermanager.js b/lib/providermanager.js index 83e11605b..a00f444a1 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -49,12 +49,12 @@ var ProviderManager = function() { result = JSON.parse(result); - // dont call the callback if result is an error, empty array or false - if (result.error || (result.result instanceof Array ? result.result.length === 0 : !result.result)) { + // dont call the callback if result is not an array, or empty one + if (result.error || !(result.result instanceof Array) || result.result.length === 0) { return; } - data.callback(result); + data.callback(result.result); }); } setTimeout(poll, 12000); |