Changeset

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
parents 10711:d2e4584ba7b3
children 10713:38159b9adf9f
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Apr 10 20:20:14 2020 +0200
+++ b/plugins/muc/muc.lib.lua	Sat Apr 11 16:41:52 2020 +0100
@@ -237,6 +237,7 @@
 		occupant = occupant; nick = nick; actor = actor;
 		reason = reason;
 	}
+	module:fire_event("muc-build-occupant-presence", event);
 	module:fire_event("muc-broadcast-presence", event);
 
 	-- Allow muc-broadcast-presence listeners to change things
@@ -342,6 +343,7 @@
 			local pres = st.clone(occupant:get_presence());
 			pres.attr.to = to;
 			pres:add_child(x);
+			module:fire_event("muc-build-occupant-presence", { room = self, occupant = occupant, stanza = pres });
 			if to_bare == occupant.bare_jid or broadcast_roles[occupant.role or "none"] then
 				self:route_stanza(pres);
 			end