Comparison

mod_privilege/mod_privilege.lua @ 1659:495a093798eb

mod_privilege: added permissions notification on initial presence for entities which are not components
author Goffi <goffi@goffi.org>
date Thu, 02 Apr 2015 21:47:05 +0200
parent 1658:1146cb4493a9
child 1660:d1072db4db44
comparison
equal deleted inserted replaced
1658:1146cb4493a9 1659:495a093798eb
71 end 71 end
72 72
73 session.privileges = ent_priv 73 session.privileges = ent_priv
74 end 74 end
75 75
76 function on_presence(event)
77 -- Permission are already checked at this point,
78 -- we only advertise them to the entity
79 local session, stanza = event.origin, event.stanza;
80 if session.privileges then
81 advertise_perm(session.full_jid, session.privileges)
82 end
83 end
84
76 module:hook('authentication-success', on_auth) 85 module:hook('authentication-success', on_auth)
77 module:hook('component-authenticated', on_auth) 86 module:hook('component-authenticated', on_auth)
87 module:hook('presence/initial', on_presence)
78 88
79 89
80 --> roster permission <-- 90 --> roster permission <--
81 91
82 module:hook("iq-get/bare/jabber:iq:roster:query", function(event) 92 module:hook("iq-get/bare/jabber:iq:roster:query", function(event)