From 1694d8908a486fdc1fcee99b98cf5a8df65be13b Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 17 Jun 2014 15:18:43 -0400 Subject: plugins/muc: Fix use of incorrect event on occupant join --- plugins/muc/history.lib.lua | 2 +- plugins/muc/muc.lib.lua | 7 +++++-- plugins/muc/subject.lib.lua | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua index 1c14cf84..4129e7fa 100644 --- a/plugins/muc/history.lib.lua +++ b/plugins/muc/history.lib.lua @@ -130,7 +130,7 @@ local function send_history(room, stanza) end -- Send history on join -module:hook("muc-occupant-joined", function(event) +module:hook("muc-occupant-session-new", function(event) send_history(event.room, event.stanza); end, 50); -- Before subject(20) diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 85c256a2..c645869e 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -487,8 +487,11 @@ function room_mt:handle_presence_to_occupant(origin, stanza) self:route_stanza(pr); end - if orig_occupant == nil and is_first_dest_session then - module:fire_event("muc-occupant-joined", {room = self; nick = dest_occupant.nick; stanza = 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;}); + end + module:fire_event("muc-occupant-session-new", {room = self; nick = dest_occupant.nick; stanza = stanza; jid = real_jid;}); end end elseif type ~= 'result' then -- bad type diff --git a/plugins/muc/subject.lib.lua b/plugins/muc/subject.lib.lua index 44fc915c..34f9a5d4 100644 --- a/plugins/muc/subject.lib.lua +++ b/plugins/muc/subject.lib.lua @@ -66,7 +66,7 @@ local function set_subject(room, from, subject) end -- Send subject to joining user -module:hook("muc-occupant-joined", function(event) +module:hook("muc-occupant-session-new", function(event) send_subject(event.room, event.stanza.attr.from); end, 20); -- cgit v1.2.3