Skip to content

Commit 0cf8215

Browse files
committed
Merge pull request buddycloud#193 from buddycloud/develop
Merging with develop
2 parents b18e0eb + 27bcf5b commit 0cf8215

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"primus-emitter": "~3.0.2",
2626
"primus": "~2.3.0",
2727
"xmpp-ftw": "~1.14.4",
28-
"xmpp-ftw-buddycloud": "~1.12.1",
28+
"xmpp-ftw-buddycloud": "~1.15.0",
2929
"socket.io": "~0.9.16",
3030
"winston": "0.7.x",
3131
"express-winston": "0.2.x"

src/subscriptions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function findUserAffiliations(rootEl) {
9191
return rootEl.getChildrenByFilter(function (c) {
9292
return typeof c != 'string' &&
9393
c.getName() == 'affiliation' &&
94-
c.getNS() == pubsub.ns &&
94+
c.getNS() == pubsub.ownerNS &&
9595
c.attr('node') && c.attr('node').indexOf('/user/') == 0;
9696
}, true);
9797
}
@@ -100,7 +100,7 @@ function findNodeAffiliations(rootEl) {
100100
return rootEl.getChildrenByFilter(function (c) {
101101
return typeof c != 'string' &&
102102
c.getName() == 'affiliation' &&
103-
c.getNS() == pubsub.ownerNS &&
103+
c.getNS() == pubsub.ns &&
104104
c.attr('jid') && c.attr('jid').indexOf('@') != 0;
105105
}, true);
106106
}
@@ -236,6 +236,11 @@ function changeNodeSubscriptions(req, res) {
236236
//// GET /<channel>/subscribers/<node>/approve /////////////////////////////////////////
237237

238238
function getPendingNodeSubscriptions(req, res) {
239+
if (!req.user) {
240+
api.sendUnauthorized(res);
241+
return;
242+
}
243+
239244
var channel = req.params.channel;
240245
var node = req.params.node;
241246
requestNodeSubscriptions(req, res, channel, node, function(reply) {

src/websocket.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ var Emitter = require('primus-emitter')
33
, xmpp = require('xmpp-ftw')
44
, Buddycloud = require('xmpp-ftw-buddycloud');
55

6+
var cache = {}
7+
68
module.exports = function(config, server, logger) {
79
var options = {
810
transformer: 'socket.io',
@@ -23,12 +25,14 @@ module.exports = function(config, server, logger) {
2325
primus.on('connection', function(socket) {
2426
logger.debug('Websocket connection made');
2527
var xmppFtw = new xmpp.Xmpp(socket);
26-
xmppFtw.addListener(new Buddycloud());
28+
var buddycloud = new Buddycloud();
29+
buddycloud.setCache(cache);
30+
xmppFtw.addListener(buddycloud);
2731
socket.xmppFtw = xmppFtw;
2832
})
2933

3034
primus.on('disconnection', function(socket) {
3135
logger.debug('Client disconnected, logging them out');
3236
socket.xmppFtw.logout();
3337
})
34-
}
38+
}

test/subscriptions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var mockConfig = {
5050
</pubsub>\
5151
</iq>':
5252
'<iq type="result">\
53-
<pubsub xmlns="http://jabber.org/protocol/pubsub">\
53+
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">\
5454
<affiliations>\
5555
<affiliation node="/user/alice@localhost/posts" \
5656
affiliation="owner"/>\
@@ -67,7 +67,7 @@ var mockConfig = {
6767
</pubsub>\
6868
</iq>':
6969
'<iq type="result">\
70-
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">\
70+
<pubsub xmlns="http://jabber.org/protocol/pubsub">\
7171
<affiliations node="/user/alice@localhost/posts">\
7272
<affiliation jid="alice@localhost" affiliation="owner"/>\
7373
<affiliation jid="bob@localhost" affiliation="subscriber"/>\
@@ -98,7 +98,7 @@ var mockConfig = {
9898
</pubsub>\
9999
</iq>':
100100
'<iq type="result">\
101-
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">\
101+
<pubsub xmlns="http://jabber.org/protocol/pubsub">\
102102
<affiliations node="/user/alice@localhost/posts">\
103103
<affiliation jid="alice@localhost" affiliation="owner"/>\
104104
<affiliation jid="bob@localhost" affiliation="subscriber"/>\
@@ -125,7 +125,7 @@ var mockConfig = {
125125
</pubsub>\
126126
</iq>':
127127
'<iq type="result">\
128-
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">\
128+
<pubsub xmlns="http://jabber.org/protocol/pubsub">\
129129
<affiliations node="/user/alice@localhost/posts">\
130130
<affiliation jid="alice@localhost" affiliation="owner"/>\
131131
<affiliation jid="bob@localhost" affiliation="subscriber"/>\

0 commit comments

Comments
 (0)