Changeset

6513:3bbd59c03aeb

plugins/muc/muc.lib: Allow muc-broadcast-presence event listeners to modify nick, actor, reason
author daurnimator <quae@daurnimator.com>
date Fri, 14 Nov 2014 17:37:47 -0500
parents 6512:ad159be9e9d7
children 6514:d425fc41e59f
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Tue Nov 11 13:08:34 2014 -0500
+++ b/plugins/muc/muc.lib.lua	Fri Nov 14 17:37:47 2014 -0500
@@ -198,13 +198,20 @@
 	base_presence = base_presence or st.presence {from = occupant.nick; type = "unavailable";};
 
 	-- Fire event (before full_p and anon_p are created)
-	module:fire_event("muc-broadcast-presence", {
+	local event = {
 		room = self; stanza = base_presence; x = base_x;
 		occupant = occupant; nick = nick; actor = actor;
 		reason = reason;
-	});
+	}
+	module:fire_event("muc-broadcast-presence", event);
+
+	-- Allow muc-broadcast-presence listeners to change things
+	nick = event.nick;
+	actor = event.actor;
+	reason = event.reason;
 
 	local whois = self:get_whois();
+
 	local actor_nick;
 	if actor then
 		actor_nick = select(3, jid_split(self:get_occupant_jid(actor)));