aboutsummaryrefslogtreecommitdiffstats
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
commitf117cb8cbfe55da0063889edf5a48bf268da3a08 (patch)
tree1d7d6a3eed31fd4b3d1d11609252a37dd9d49993
parentff0c8c3e62fe427352089108e867cc70538739d9 (diff)
downloadprosody-f117cb8cbfe55da0063889edf5a48bf268da3a08.tar.gz
prosody-f117cb8cbfe55da0063889edf5a48bf268da3a08.zip
muc: Add 'occupant' to muc-occupant-{joined,left,session-new} events (thanks daurnimator/fippo)
-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