# HG changeset patch # User Emmanuel Gil Peyrot # Date 1282863776 -7200 # Node ID 44889cfb2f8c9751fbed699a7449cc3b7e83d548 # Parent a6429f48e40397fb69d0367bd1d4012db767eeee Fix getItem method. diff --git a/configuration.js b/configuration.js --- a/configuration.js +++ b/configuration.js @@ -205,7 +205,8 @@ config.Configuration = function(def, par } if (params) for (var i in params) - this[i] = params[i]; + if (typeof def[i] != 'undefined') + this[i] = params[i]; }; config.enabled = function(feature) { diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -318,6 +318,8 @@ function onIq(stanza) { var j = storage.getItem(nodeID, item[i]); if (typeof j == 'number') return makeError(response, j); + if (j == errors.success) + continue; var k = xmpp.stanza('item', {id: item[i]}) k.cnode(j); diff --git a/storage.js b/storage.js --- a/storage.js +++ b/storage.js @@ -288,17 +288,14 @@ storage.existsItem = function(nodeID, it }; storage.getItem = function(nodeID, itemID) { - if (!storage.existsItem(nodeID, itemID)) - return 42; //FIXME - - var items = storage.existsItem(nodeID, itemID); + var items = storage.getItems(nodeID); if (typeof items == 'number') return items; - if (items) - return items.content; + if (items[itemID]) + return items[itemID].content; - return errors.item_not_found; + return errors.success; }; storage.getSubscription = function(jid, nodeID) {