diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-01-08 23:17:17 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-01-08 23:17:17 +0000 |
commit | db7bed21d5d5fc10cc7d12163261061d3f38c402 (patch) | |
tree | 2a5a0a6b2e7acd9d42f282b47996c454cbec678b /util | |
parent | a3e7fba56fc88371ef9b41ae490783729a705023 (diff) | |
download | prosody-db7bed21d5d5fc10cc7d12163261061d3f38c402.tar.gz prosody-db7bed21d5d5fc10cc7d12163261061d3f38c402.zip |
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).
Diffstat (limited to 'util')
-rw-r--r-- | util/pubsub.lua | 14 |
1 files 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"; |