Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 10712:dc24a8783c5d
MUC: Add new event 'muc-build-occupant-presence' for plugins to extend occupant presence
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 11 Apr 2020 16:41:52 +0100 |
parent | 10691:82959e7ecd46 |
child | 10757:9dec7cddb40b |
comparison
equal
deleted
inserted
replaced
10711:d2e4584ba7b3 | 10712:dc24a8783c5d |
---|---|
235 local event = { | 235 local event = { |
236 room = self; stanza = base_presence; x = base_x; | 236 room = self; stanza = base_presence; x = base_x; |
237 occupant = occupant; nick = nick; actor = actor; | 237 occupant = occupant; nick = nick; actor = actor; |
238 reason = reason; | 238 reason = reason; |
239 } | 239 } |
240 module:fire_event("muc-build-occupant-presence", event); | |
240 module:fire_event("muc-broadcast-presence", event); | 241 module:fire_event("muc-broadcast-presence", event); |
241 | 242 |
242 -- Allow muc-broadcast-presence listeners to change things | 243 -- Allow muc-broadcast-presence listeners to change things |
243 nick = event.nick; | 244 nick = event.nick; |
244 actor = event.actor; | 245 actor = event.actor; |
340 local x = st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'}); | 341 local x = st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'}); |
341 self:build_item_list(occupant, x, is_anonymous and to_bare ~= occupant.bare_jid); -- can always see your own jids | 342 self:build_item_list(occupant, x, is_anonymous and to_bare ~= occupant.bare_jid); -- can always see your own jids |
342 local pres = st.clone(occupant:get_presence()); | 343 local pres = st.clone(occupant:get_presence()); |
343 pres.attr.to = to; | 344 pres.attr.to = to; |
344 pres:add_child(x); | 345 pres:add_child(x); |
346 module:fire_event("muc-build-occupant-presence", { room = self, occupant = occupant, stanza = pres }); | |
345 if to_bare == occupant.bare_jid or broadcast_roles[occupant.role or "none"] then | 347 if to_bare == occupant.bare_jid or broadcast_roles[occupant.role or "none"] then |
346 self:route_stanza(pres); | 348 self:route_stanza(pres); |
347 end | 349 end |
348 end | 350 end |
349 end | 351 end |