# HG changeset patch # User Matthew Wild # Date 1294528637 0 # Node ID 69e3f1e7111e4a8b097570664227b0e823b81d8c # Parent 5c0b7947f0eff2a106c06df4ff0f8b52517b179b util.pubsub: Pass true instead of nil as the actor in a bunch of places, and fix a bunch of methods to not traceback on this (those with *_other capability checking). diff -r 5c0b7947f0ef -r 69e3f1e7111e util/pubsub.lua --- a/util/pubsub.lua Sat Jan 08 23:15:27 2011 +0000 +++ b/util/pubsub.lua Sat Jan 08 23:17:17 2011 +0000 @@ -69,14 +69,14 @@ return false, "item-not-found"; end node_obj.affiliations[jid] = affiliation; - local _, jid_sub = self:get_subscription(node, nil, jid); + local _, jid_sub = self:get_subscription(node, true, jid); if not jid_sub and not self:may(node, jid, "be_unsubscribed") then - local ok, err = self:add_subscription(node, nil, jid); + local ok, err = self:add_subscription(node, true, jid); if not ok then return ok, err; end elseif jid_sub and not self:may(node, jid, "be_subscribed") then - local ok, err = self:add_subscription(node, nil, jid); + local ok, err = self:add_subscription(node, true, jid); if not ok then return ok, err; end @@ -87,7 +87,7 @@ function service:add_subscription(node, actor, jid, options) -- Access checking local cap; - if jid == actor or self:jids_equal(actor, jid) then + if actor == true or jid == actor or self:jids_equal(actor, jid) then cap = "subscribe"; else cap = "subscribe_other"; @@ -129,7 +129,7 @@ function service:remove_subscription(node, actor, jid) -- Access checking local cap; - if jid == actor or self:jids_equal(actor, jid) then + if actor == true or jid == actor or self:jids_equal(actor, jid) then cap = "unsubscribe"; else cap = "unsubscribe_other"; @@ -169,7 +169,7 @@ function service:get_subscription(node, actor, jid) -- Access checking local cap; - if jid == actor or self:jids_equal(actor, jid) then + if actor == true or jid == actor or self:jids_equal(actor, jid) then cap = "get_subscription"; else cap = "get_subscription_other"; @@ -277,7 +277,7 @@ function service:get_subscriptions(node, actor, jid) -- Access checking local cap; - if jid == actor or self:jids_equal(actor, jid) then + if actor == true or jid == actor or self:jids_equal(actor, jid) then cap = "get_subscriptions"; else cap = "get_subscriptions_other";