changeset 10:44889cfb2f8c

Fix getItem method.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 27 Aug 2010 01:02:56 +0200
parents a6429f48e403
children 0ed3c06c5191
files configuration.js psgxs.js storage.js
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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) {
--- 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);
--- 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) {