Mercurial > prosody-modules
changeset 1662:d440a22fa0af
mod_privilege: advertise_perm method now use session.send instead of module:send to avoid to go back in hook
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 06 Apr 2015 02:08:09 +0200 |
parents | 69aa2b54ba8a |
children | ca07a6ada631 |
files | mod_privilege/mod_privilege.lua |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_privilege/mod_privilege.lua Thu Apr 02 21:47:05 2015 +0200 +++ b/mod_privilege/mod_privilege.lua Mon Apr 06 02:08:09 2015 +0200 @@ -30,7 +30,7 @@ privileges = module:get_option("privileged_entities", {}) -function advertise_perm(to_jid, perms) +function advertise_perm(session, to_jid, perms) -- send <message/> stanza to advertise permissions -- as expained in section 4.2 local message = st.message({to=to_jid}) @@ -41,8 +41,9 @@ message:tag("perm", {access=perm, type=perms[perm]}):up() end end + session.send(message) +end - module:send(message) end function on_auth(event) @@ -71,7 +72,7 @@ if session.type == "component" then -- we send the message stanza only for component -- it will be sent at first <presence/> for other entities - advertise_perm(bare_jid, ent_priv) + advertise_perm(session, bare_jid, ent_priv) end end @@ -83,7 +84,7 @@ -- we only advertise them to the entity local session, stanza = event.origin, event.stanza; if session.privileges then - advertise_perm(session.full_jid, session.privileges) + advertise_perm(session, session.full_jid, session.privileges) end end