diff storage.js @ 10:44889cfb2f8c

Fix getItem method.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 27 Aug 2010 01:02:56 +0200
parents a6429f48e403
children 9a6b8b3357c6
line wrap: on
line diff
--- 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) {