aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-09-26 17:34:15 +0100
committerMatthew Wild <mwild1@gmail.com>2014-09-26 17:34:15 +0100
commit86f985a23d2405f172614e8f22fdc474ff56e81c (patch)
tree1d7d6a3eed31fd4b3d1d11609252a37dd9d49993 /plugins
parent1f39fe0a715664ba4ca140d8da47d06a772fa13c (diff)
downloadprosody-86f985a23d2405f172614e8f22fdc474ff56e81c.tar.gz
prosody-86f985a23d2405f172614e8f22fdc474ff56e81c.zip
muc: Add 'occupant' to muc-occupant-{joined,left,session-new} events (thanks daurnimator/fippo)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 35dd9eac..99d0ad07 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -398,10 +398,14 @@ function room_mt:handle_presence_to_occupant(origin, stanza)
if orig_occupant == nil then
event_name = "muc-occupant-pre-join";
event.is_new_room = is_new_room;
+ event.occupant = dest_occupant;
elseif dest_occupant == nil then
event_name = "muc-occupant-pre-leave";
+ event.occupant = orig_occupant;
else
event_name = "muc-occupant-pre-change";
+ event.orig_occupant = orig_occupant;
+ event.dest_occupant = dest_occupant;
end
if module:fire_event(event_name, event) then return true; end
@@ -460,7 +464,7 @@ function room_mt:handle_presence_to_occupant(origin, stanza)
self:publicise_occupant_status(orig_occupant, orig_x, dest_nick);
if is_last_orig_session then
- module:fire_event("muc-occupant-left", {room = self; nick = orig_occupant.nick;});
+ module:fire_event("muc-occupant-left", {room = self; nick = orig_occupant.nick; occupant = orig_occupant;});
end
end
@@ -498,9 +502,9 @@ function room_mt:handle_presence_to_occupant(origin, stanza)
if orig_occupant == nil then
if is_first_dest_session then
- module:fire_event("muc-occupant-joined", {room = self; nick = dest_occupant.nick; stanza = stanza;});
+ module:fire_event("muc-occupant-joined", {room = self; nick = dest_occupant.nick; occupant = dest_occupant;});
end
- module:fire_event("muc-occupant-session-new", {room = self; nick = dest_occupant.nick; stanza = stanza; jid = real_jid;});
+ module:fire_event("muc-occupant-session-new", {room = self; nick = dest_occupant.nick; occupant = dest_occupant; stanza = stanza; jid = real_jid;});
end
end
elseif type ~= 'result' then -- bad type
@@ -669,7 +673,7 @@ function room_mt:clear(x)
end
for occupant in pairs(occupants_updated) do
self:publicise_occupant_status(occupant, x);
- module:fire_event("muc-occupant-left", { room = self; nick = occupant.nick; });
+ module:fire_event("muc-occupant-left", { room = self; nick = occupant.nick; occupant = occupant;});
end
end