diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-12-22 03:04:14 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-12-22 03:04:14 +0000 |
commit | 9622bf99fb225ede604c657cc8588a11cd49aa09 (patch) | |
tree | 4eb56f5d452142e51227c220dc8ef43627e76edc /util/pubsub.lua | |
parent | 6b11075f6484ddd8f3323bf62f30c394ab21fc8d (diff) | |
download | prosody-9622bf99fb225ede604c657cc8588a11cd49aa09.tar.gz prosody-9622bf99fb225ede604c657cc8588a11cd49aa09.zip |
util.pubsub: Add service:jids_equal() and new config option normalize_jid
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r-- | util/pubsub.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index f7d4a702..d43ed1db 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -18,6 +18,11 @@ function new(config) }, service_mt); end +function service:jids_equal(jid1, jid2) + local normalize = self.config.normalize_jid; + return normalize(jid1) == normalize(jid2); +end + function service:may(node, actor, action) if actor == true then return true; end @@ -82,7 +87,7 @@ end function service:add_subscription(node, actor, jid, options) -- Access checking local cap; - if jid == actor or self.config.jids_equal(actor, jid) then + if jid == actor or self:jids_equal(actor, jid) then cap = "subscribe"; else cap = "subscribe_other"; @@ -112,7 +117,7 @@ end function service:remove_subscription(node, actor, jid) -- Access checking local cap; - if jid == actor or self.config.jids_equal(actor, jid) then + if jid == actor or self:jids_equal(actor, jid) then cap = "unsubscribe"; else cap = "unsubscribe_other"; @@ -138,7 +143,7 @@ end function service:get_subscription(node, actor, jid) -- Access checking local cap; - if jid == actor or self.config.jids_equal(actor, jid) then + if jid == actor or self:jids_equal(actor, jid) then cap = "get_subscription"; else cap = "get_subscription_other"; |