From db7bed21d5d5fc10cc7d12163261061d3f38c402 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 8 Jan 2011 23:17:17 +0000 Subject: 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). --- util/pubsub.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/util/pubsub.lua b/util/pubsub.lua index 97611d00..69e79acc 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -69,14 +69,14 @@ function service:set_affiliation(node, actor, jid, affiliation) 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 @@ end 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 @@ end 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 @@ end 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 @@ end 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"; -- cgit v1.2.3