diff modules/mod_publish_message.js @ 35:6697f394301f

Replace util with fdsq to work around a stupid bug.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 10 Nov 2010 01:30:03 +0100
parents dcf1f09f8cee
children bc717575e66a
line wrap: on
line diff
--- a/modules/mod_publish_message.js
+++ b/modules/mod_publish_message.js
@@ -2,20 +2,20 @@ var config = require('../configuration')
 var storage = require('../storage');
 var notifs = require('../notifs');
 var errors = require('../errors');
-var utils = require('../util');
-var toBareJID = utils.toBareJID;
+var makeError = errors.makeError;
+var fdsq = require('../fdsq');
+var toBareJID = fdsq.toBareJID;
 var NS = require('../namespaces');
 var xmpp = require('xmpp');
 
-exports.publish = {
+exports.publishMessage = {
 	stanza: 'message',
 	child: 'body',
 	func: function(response, stanza, request, to, from) {
 		if (!config.enabled('publish'))
 			return makeError(response, errors.pub.publish.item_publication_not_supported.n);
 
-		var nodeID = utils.toResource(from);
-		console.log(require('sys').inspect(nodeID));
+		var nodeID = fdsq.toResource(from);
 		if (!nodeID || nodeID == '')
 			return makeError(response, errors.nodeid_required.n);
 
@@ -35,7 +35,7 @@ exports.publish = {
 
 		if (!config.enabled('item-ids'))
 			return makeError(response, errors.itemid_required.n);
-		var itemID = utils.makeRandomId();
+		var itemID = fdsq.makeRandomId();
 
 		var now = new Date();
 
@@ -47,7 +47,6 @@ exports.publish = {
 		item.c('id').t(itemID).up();
 		item.c('published').t(now.toString()).up();
 		item.c('updated').t(now.toString()).up();
-		console.log(require('sys').inspect(item, false, null));
 
 		if (!config.enabled('persistent-items')) {
 			var notifications = storage.purgeNode(nodeID);