Comparison

mod_privilege/mod_privilege.lua @ 1664:6bdcb1418029

mod_privilege: implemented "managed_entity" presence
author Goffi <goffi@goffi.org>
date Tue, 07 Apr 2015 12:47:47 +0200
parent 1663:ca07a6ada631
child 1665:746d94f37a4c
comparison
equal deleted inserted replaced
1663:ca07a6ada631 1664:6bdcb1418029
285 session.send(st.error_reply(stanza, 'auth', 'forbidden')) 285 session.send(st.error_reply(stanza, 'auth', 'forbidden'))
286 end 286 end
287 287
288 return true 288 return true
289 end); 289 end);
290
291
292 --> presence permission <--
293
294 module:hook("presence/bare", function(event)
295 if presence_man_ent:empty() then return; end
296 local session, stanza = event.origin, event.stanza;
297 if stanza.attr.to then return; end
298 if stanza.attr.type == nil or stanza.attr.type == "unavailable" then
299 for entity in presence_man_ent:items() do
300 if stanza.attr.from ~= entity then
301 presence_fwd = st.clone(stanza)
302 presence_fwd.attr.to = entity
303 module:log("debug", "presence forwarded to "..entity..": "..tostring(presence_fwd))
304 prosody.core_route_stanza(nil, presence_fwd)
305 end
306 end
307 end
308 end, 150);