Comparison

plugins/muc/muc.lib.lua @ 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
parent 6512:ad159be9e9d7
child 6769:4caef6d53304
comparison
equal deleted inserted replaced
6512:ad159be9e9d7 6513:3bbd59c03aeb
196 end 196 end
197 end 197 end
198 base_presence = base_presence or st.presence {from = occupant.nick; type = "unavailable";}; 198 base_presence = base_presence or st.presence {from = occupant.nick; type = "unavailable";};
199 199
200 -- Fire event (before full_p and anon_p are created) 200 -- Fire event (before full_p and anon_p are created)
201 module:fire_event("muc-broadcast-presence", { 201 local event = {
202 room = self; stanza = base_presence; x = base_x; 202 room = self; stanza = base_presence; x = base_x;
203 occupant = occupant; nick = nick; actor = actor; 203 occupant = occupant; nick = nick; actor = actor;
204 reason = reason; 204 reason = reason;
205 }); 205 }
206 module:fire_event("muc-broadcast-presence", event);
207
208 -- Allow muc-broadcast-presence listeners to change things
209 nick = event.nick;
210 actor = event.actor;
211 reason = event.reason;
206 212
207 local whois = self:get_whois(); 213 local whois = self:get_whois();
214
208 local actor_nick; 215 local actor_nick;
209 if actor then 216 if actor then
210 actor_nick = select(3, jid_split(self:get_occupant_jid(actor))); 217 actor_nick = select(3, jid_split(self:get_occupant_jid(actor)));
211 end 218 end
212 219