diff modules/mod_retrieve.js @ 41:bc717575e66a

Much better handling of modules.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 20 Feb 2011 15:51:12 +0100
parents 4c808bfe0658
children 023f767662d3
line wrap: on
line diff
--- a/modules/mod_retrieve.js
+++ b/modules/mod_retrieve.js
@@ -1,12 +1,3 @@
-var config = require('../configuration');
-var storage = require('../storage');
-var errors = require('../errors');
-var makeError = errors.makeError;
-var toBareJID = require('../fdsq').toBareJID;
-var NS = require('../namespaces');
-
-console.log(require('sys').inspect(toBareJID, false, null));
-
 // SECTION 5.6: Retrieve Subscriptions
 exports.retrieveSubscriptions = {
 	type: 'get',
@@ -25,8 +16,8 @@ exports.retrieveSubscriptions = {
 		} else
 			var subs = storage.getSubscription(toBareJID(to));
 
-		response.c('pubsub', {xmlns: NS.PUBSUB});
-		response.c('subscriptions');
+		response.c('pubsub', {xmlns: NS.PUBSUB})
+			.c('subscriptions');
 
 		for (i in subs)
 			response.c('subscription', {node: i, jid: to, subscription: subs[i].type, subid: subs[i].subid}).up();
@@ -54,8 +45,8 @@ exports.retrieveAffiliations = {
 		} else
 			var affils = storage.getAffiliationsFromJID(toBareJID(to));
 
-		response.c('pubsub', {xmlns: NS.PUBSUB});
-		response.c('affiliations');
+		response.c('pubsub', {xmlns: NS.PUBSUB})
+			.c('affiliations');
 
 		for (i in affils)
 			response.c('affiliation', {node: i, affiliation: affils[i]}).up();
@@ -111,7 +102,7 @@ exports.retrieveItems = {
 					continue;
 
 				response.c('item', {id: item[i]})
-				response.cnode(j).up().up();
+					.cnode(j).up().up();
 			}
 		} else {
 			response.c('items', {node: nodeID});