Mercurial > psgxs
diff modules/mod_owner.js @ 30:b2faacfefb90
Rewrite of the module manager; fix of some modules; fix of the directory backend.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 04 Nov 2010 17:50:52 +0100 |
parents | b80ab94da447 |
children | 8735fc6f6f53 |
line wrap: on
line diff
--- a/modules/mod_owner.js +++ b/modules/mod_owner.js @@ -8,11 +8,11 @@ var toBareJID = require('../util').toBar var NS = require('../namespaces'); // SECTION 8.1: Create a Node -exports.getConfigure = { +exports.create = { type: 'set', child: 'pubsub', ns: NS.PUBSUB, - pschild: 'create', + child2: 'create', func: function(response, stanza, request, to) { if (!config.enabled('create-nodes')) return makeError(response, errors.owner.create.node_creation_not_supported.n); @@ -45,7 +45,10 @@ exports.getConfigure = { if (!right) return makeError(response, errors.forbidden.n); - var r = storage.createNode(nodeID); + conf = {}; + conf['pubsub#creator'] = bare; + + var r = storage.createNode(nodeID, conf); if (typeof r == 'number') return makeError(response, r); @@ -62,7 +65,7 @@ exports['delete'] = { type: 'set', child: 'pubsub', ns: NS.PUBSUB_OWNER, - pschild: 'delete', + child2: 'delete', func: function(response, stanza, request, to) { if (!config.enabled('delete-nodes')) return makeError(response, errors.feature_not_implemented.n); //XXX @@ -77,11 +80,11 @@ exports['delete'] = { if (affil != 'super-owner' && affil != 'owner') return makeError(response, errors.forbidden.n); - var notifs = storage.deleteNode(nodeID); - if (typeof notifs == 'number') + var notifications = storage.deleteNode(nodeID); + if (typeof notifications == 'number') return makeError(response, r); - notifs.send(notifs, 'delete', nodeID); + notifs.send(notifications, 'delete', nodeID); return response; } @@ -92,7 +95,7 @@ exports.purge = { type: 'set', child: 'pubsub', ns: NS.PUBSUB_OWNER, - pschild: 'purge', + child2: 'purge', func: function(response, stanza, request, to) { if (!config.enabled('purge-nodes')) return makeError(response, errors.owner.purge.node_purging_not_supported.n); //XXX @@ -110,11 +113,11 @@ exports.purge = { if (!config.enabled('persistent-items')) //FIXME: autre condition, supporté par le node return makeError(response, errors.owner.purge.node_does_not_persist_items.n); - var notifs = storage.purgeNode(nodeID); - if (typeof notifs == 'number') + var notifications = storage.purgeNode(nodeID); + if (typeof notifications == 'number') return makeError(response, r); - notifs.send(notifs, 'purge', nodeID); + notifs.send(notifications, 'purge', nodeID); return response; }