# HG changeset patch # User Emmanuel Gil Peyrot # Date 1287507094 -7200 # Node ID 75625771e41059762684f3d47a06d4d4eda66efe # Parent ec7cea92fe8ad169b00ab7620482bce6e03d21af Send subscription request only if node access_model is authorize. diff --git a/psgxs.js b/psgxs.js --- a/psgxs.js +++ b/psgxs.js @@ -522,6 +522,16 @@ function onIq(stanza) { subID = storage.subscribe(nodeID, jid, 'pending', conf); if (typeof subID == 'number') return makeError(response, subID); + + var affiliates = storage.getAffiliationsFromNodeID(nodeID); + var form = forms.build('form', 'subscribe_authorization', {allow: false, node: nodeID, subscriber_jid: jid}, true); //168 + + for (var i in affiliates) { + if (affiliates[i] == 'super-owner' || affiliates[i] == 'owner') { + var message = xmpp.message({to: i}).cnode(form); + conn.send(message); + } + } } else if (configuration['pubsub#access_model'] == 'whitelist') { var affil = storage.getAffiliation(jid, nodeID); if (affil != 'super-owner' && affil != 'owner' && affil != 'publisher' && affil != 'member') @@ -538,17 +548,6 @@ function onIq(stanza) { if (conf) response.cnode(options); - if (config.enabled('get-pending')) { - var affiliates = storage.getAffiliationsFromNodeID(nodeID); - var form = forms.build('form', 'subscribe_authorization', {allow: false, node: nodeID, subscriber_jid: jid}, true); //168 - for (var i in affiliates) { - if (affiliates[i] == 'super-owner' || affiliates[i] == 'owner') { - var message = xmpp.message({to: i}).cnode(form); - conn.send(message); - } - } - } - if (config.enabled('last-published')) { var last = storage.getLastItem(nodeID); if (typeof last != 'number') {