Mercurial > psgxs
changeset 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 | 26eb015a7c40 |
files | modules/mod_adhoc.js modules/mod_configure.js modules/mod_manage.js modules/mod_options.js modules/mod_owner.js modules/mod_publish.js modules/mod_publish_message.js modules/mod_retrieve.js modules/mod_subscribe.js nodes.js psgxs.js storage.js |
diffstat | 12 files changed, 26 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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
--- 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)
--- 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))
--- 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);
--- 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);
--- 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',
--- 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
--- 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;
--- 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();
--- 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)