# HG changeset patch # User Emmanuel Gil Peyrot # Date 1289349003 -3600 # Node ID 6697f394301ff61e370b83704ba74a31b210b01d # Parent dcf1f09f8cee849c53940e2d3b170193c04c0038 Replace util with fdsq to work around a stupid bug. diff --git a/modules/mod_adhoc.js b/modules/mod_adhoc.js --- a/modules/mod_adhoc.js +++ b/modules/mod_adhoc.js @@ -3,7 +3,7 @@ var storage = require('../storage'); var forms = require('../forms'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +var toBareJID = require('../fdsq').toBareJID; var NS = require('../namespaces'); // XEP-0050: Ad-Hoc Commands diff --git a/modules/mod_configure.js b/modules/mod_configure.js --- a/modules/mod_configure.js +++ b/modules/mod_configure.js @@ -3,7 +3,7 @@ var storage = require('../storage'); var forms = require('../forms'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +var toBareJID = require('../fdsq').toBareJID; var NS = require('../namespaces'); // SECTION 8.2: Configure a Node diff --git a/modules/mod_manage.js b/modules/mod_manage.js --- a/modules/mod_manage.js +++ b/modules/mod_manage.js @@ -2,7 +2,7 @@ var config = require('../configuration') var storage = require('../storage'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +var toBareJID = require('../fdsq').toBareJID; var NS = require('../namespaces'); // SECTION 8.8.1: Retrieve Subscriptions List diff --git a/modules/mod_options.js b/modules/mod_options.js --- a/modules/mod_options.js +++ b/modules/mod_options.js @@ -3,7 +3,7 @@ var storage = require('../storage'); var forms = require('../forms'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +var toBareJID = require('../fdsq').toBareJID; var NS = require('../namespaces'); // SECTION 6.3.2: Configure Subscription Options (Request) diff --git a/modules/mod_owner.js b/modules/mod_owner.js --- a/modules/mod_owner.js +++ b/modules/mod_owner.js @@ -4,8 +4,8 @@ var forms = require('../forms'); var notifs = require('../notifs'); var errors = require('../errors'); var makeError = errors.makeError; -var utils = require('../util'); -var toBareJID = utils.toBareJID; +var fdsq = require('../fdsq'); +var toBareJID = fdsq.toBareJID; var NS = require('../namespaces'); // SECTION 8.1: Create a Node @@ -24,7 +24,7 @@ exports.create = { if (!nodeID || nodeID == '') { if (!config.enabled('instant-nodes')) return makeError(response, errors.owner.create.instant_nodes_not_supported.n); - nodeID = utils.makeRandomId(); + nodeID = fdsq.makeRandomId(); instant = true; } if (storage.existsNode(nodeID)) diff --git a/modules/mod_publish.js b/modules/mod_publish.js --- a/modules/mod_publish.js +++ b/modules/mod_publish.js @@ -2,8 +2,8 @@ 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 fdsq = require('../fdsq'); +var toBareJID = fdsq.toBareJID; var NS = require('../namespaces'); // SECTION 7.1: Publish an Item to a Node @@ -38,7 +38,7 @@ exports.publish = { var itemID = item.getAttribute('id'); if (!config.enabled('item-ids') && itemID) return makeError(response, errors.itemid_required.n); - itemID = itemID? itemID: utils.makeRandomId(); + itemID = itemID? itemID: fdsq.makeRandomId(); if (item.tags.length != 1) return makeError(response, errors.pub.publish.bad_payload.n); diff --git a/modules/mod_publish_message.js b/modules/mod_publish_message.js --- 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); diff --git a/modules/mod_retrieve.js b/modules/mod_retrieve.js --- a/modules/mod_retrieve.js +++ b/modules/mod_retrieve.js @@ -2,9 +2,11 @@ var config = require('../configuration') var storage = require('../storage'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +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', diff --git a/modules/mod_subscribe.js b/modules/mod_subscribe.js --- a/modules/mod_subscribe.js +++ b/modules/mod_subscribe.js @@ -2,7 +2,7 @@ var config = require('../configuration') var storage = require('../storage'); var errors = require('../errors'); var makeError = errors.makeError; -var toBareJID = require('../util').toBareJID; +var toBareJID = require('../fdsq').toBareJID; var NS = require('../namespaces'); // SECTION 6.1: Subscribe to a Node diff --git a/nodes.js b/nodes.js --- a/nodes.js +++ b/nodes.js @@ -22,7 +22,7 @@ var errors = require('./errors'); var config = require('./configuration'); var service_configuration = config.service_configuration; var Configuration = config.Configuration; -var makeRandomId = require('./util').makeRandomId; +var makeRandomId = require('./fdsq').makeRandomId; exports.Item = function() { this.content = null; diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -25,8 +25,8 @@ require('./iso8601'); var storage = require('./storage'); var errors = require('./errors'); var makeError = errors.makeError; -var utils = require('./util'); -var toBareJID = utils.toBareJID; +var fdsq = require('./fdsq'); +var toBareJID = fdsq.toBareJID; var config = require('./configuration'); var forms = require('./forms'); var conn = new xmpp.Connection(); diff --git a/storage.js b/storage.js --- a/storage.js +++ b/storage.js @@ -24,8 +24,8 @@ var errors = require('./errors'); var config = require('./configuration'); var service_configuration = config.service_configuration; var Configuration = config.Configuration; -var utils = require('./util'); -var toBareJID = utils.toBareJID; +var fdsq = require('./fdsq'); +var toBareJID = fdsq.toBareJID; var nodes = require('./nodes'); var Node = nodes.Node; @@ -206,7 +206,7 @@ storage.setItem = function(nodeID, itemI return node; if (typeof itemID != 'string') - itemID = utils.makeRandomId(); + itemID = fdsq.makeRandomId(); i = node.setItem(itemID, content); if (content)