# HG changeset patch # User Emmanuel Gil Peyrot # Date 1282567315 -7200 # Node ID 2bcadb0531f422e1e4373c451c51210fadcf8e50 # Parent d8a98540d7492fae8e5b89e8fcd32bdc7259aa04 A few changes. diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -86,7 +86,7 @@ function onIq(stanza) { if (conf['pubsub#node_type']) type = conf['pubsub#node_type']; - var q = xmpp.stanza('query', {xmlns: 'http://jabber.org/protocol/disco#info'}) + var q = xmpp.stanza('query', {xmlns: 'http://jabber.org/protocol/disco#info', node: nodeID}) q.s('identity', {category: 'pubsub', type: type}); q.s('feature', {'var': 'http://jabber.org/protocol/pubsub'}); @@ -191,12 +191,15 @@ function onIq(stanza) { if (nodeID && nodeID != '') { if (!storage.existsNode(nodeID)) return makeError(response, errors.node_does_not_exist.n); - affils = storage.getAffiliation(toBareJID(to), nodeID); + affils = {}; + affils[nodeID] = storage.getAffiliation(toBareJID(to), nodeID); } else affils = storage.getAffiliationsFromJID(toBareJID(to)); + var s = xmpp.stanza('affiliations'); for (i in affils) s.s('affiliation', {node: i, affiliation: affils[i]}); + var p = xmpp.stanza('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub'}); p.cx(s); response.cx(p); @@ -267,9 +270,12 @@ function onIq(stanza) { if (!storage.existsNode(nodeID)) return makeError(response, errors.node_does_not_exist.n); - var affil = storage.getAffiliation(toBareJID(to), nodeID); - if (affil != 'super-owner' && affil != 'owner' && affil != 'publisher' && affil != 'member') - return makeError(response, errors.pub.publish.insufficient_privileges.n); + var configuration = storage.getConfiguration(nodeID); + if (configuration['pubsub#access_model'] == 'whitelist') { + var affil = storage.getAffiliation(toBareJID(to), nodeID); + if (affil != 'super-owner' && affil != 'owner' && affil != 'publisher' && affil != 'member') + return makeError(response, errors.pub.publish.insufficient_privileges.n); + } var item = []; for (var i=0; i