Created
December 13, 2010 20:57
-
-
Save zeen/739591 to your computer and use it in GitHub Desktop.
Limits subscription requests to admins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- mod_limit_subscription | |
-- Limits subscription requests to admins | |
local st = require "util.stanza"; | |
local is_admin = usermanager.is_admin; | |
function subscription_handler(event) | |
local origin, stanza = event.origin, event.stanza; | |
if stanza.attr.type == "subscribe" and not is_admin(origin.full_jid, module.host) then | |
origin.send(st.error_reply(stanza, "cancel", "not-authorized")); | |
return true; | |
end | |
end | |
module:hook("pre-presence/bare", subscription_handler, 100); | |
module:hook("pre-presence/full", subscription_handler, 100); | |
module:hook("pre-presence/host", subscription_handler, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment