Mercurial > psgxs
comparison modules/mod_manage.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 | 6697f394301f |
children | 023f767662d3 |
comparison
equal
deleted
inserted
replaced
40:741110cdcfcf | 41:bc717575e66a |
---|---|
1 var config = require('../configuration'); | |
2 var storage = require('../storage'); | |
3 var errors = require('../errors'); | |
4 var makeError = errors.makeError; | |
5 var toBareJID = require('../fdsq').toBareJID; | |
6 var NS = require('../namespaces'); | |
7 | |
8 // SECTION 8.8.1: Retrieve Subscriptions List | 1 // SECTION 8.8.1: Retrieve Subscriptions List |
9 exports.manageRetrieveSub = { | 2 exports.manageRetrieveSub = { |
10 type: 'get', | 3 type: 'get', |
11 child: 'pubsub', | 4 child: 'pubsub', |
12 ns: NS.PUBSUB_OWNER, | 5 ns: NS.PUBSUB_OWNER, |
23 | 16 |
24 var affil = storage.getAffiliation(toBareJID(to), nodeID); | 17 var affil = storage.getAffiliation(toBareJID(to), nodeID); |
25 if (affil != 'super-owner' && affil != 'owner') | 18 if (affil != 'super-owner' && affil != 'owner') |
26 return makeError(response, errors.forbidden.n); | 19 return makeError(response, errors.forbidden.n); |
27 | 20 |
28 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}); | 21 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}) |
29 response.c('subscriptions', {node: nodeID}); | 22 .c('subscriptions', {node: nodeID}); |
30 | 23 |
31 var subs = storage.getSubscriptionsFromNodeID(nodeID) | 24 var subs = storage.getSubscriptionsFromNodeID(nodeID) |
32 for (var jid in subs) | 25 for (var jid in subs) |
33 response.c('subscription', {jid: jid, subscription: subs[jid].type, subid: subs[jid].subid}).up(); | 26 response.c('subscription', {jid: jid, subscription: subs[jid].type, subid: subs[jid].subid}).up(); |
34 | 27 |
55 var affils = storage.getAffiliationsFromNodeID(nodeID); | 48 var affils = storage.getAffiliationsFromNodeID(nodeID); |
56 var affil = affils[toBareJID(to)]; | 49 var affil = affils[toBareJID(to)]; |
57 if (affil != 'super-owner' && affil != 'owner') | 50 if (affil != 'super-owner' && affil != 'owner') |
58 return makeError(response, errors.owner.manage_affiliations.retrieve_list.entity_is_not_an_owner.n); | 51 return makeError(response, errors.owner.manage_affiliations.retrieve_list.entity_is_not_an_owner.n); |
59 | 52 |
60 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}); | 53 response.c('pubsub', {xmlns: NS.PUBSUB_OWNER}) |
61 response.c('affiliations', {node: nodeID}); | 54 .c('affiliations', {node: nodeID}); |
62 | 55 |
63 for (var jid in affils) | 56 for (var jid in affils) |
64 response.c('affiliation', {jid: jid, affiliation: affils[jid]}).up(); | 57 response.c('affiliation', {jid: jid, affiliation: affils[jid]}).up(); |
65 | 58 |
66 return response; | 59 return response; |