Changeset

6277:f2c9c36979b3

plugins/muc: Fix use of incorrect event on occupant join
author daurnimator <quae@daurnimator.com>
date Tue, 17 Jun 2014 15:18:43 -0400
parents 6276:9290a2906feb
children 6278:fcc3ef191293
files plugins/muc/history.lib.lua plugins/muc/muc.lib.lua plugins/muc/subject.lib.lua
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/history.lib.lua	Wed Jun 11 17:54:23 2014 -0400
+++ b/plugins/muc/history.lib.lua	Tue Jun 17 15:18:43 2014 -0400
@@ -130,7 +130,7 @@
 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)
 
--- a/plugins/muc/muc.lib.lua	Wed Jun 11 17:54:23 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Tue Jun 17 15:18:43 2014 -0400
@@ -487,8 +487,11 @@
 				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
--- a/plugins/muc/subject.lib.lua	Wed Jun 11 17:54:23 2014 -0400
+++ b/plugins/muc/subject.lib.lua	Tue Jun 17 15:18:43 2014 -0400
@@ -66,7 +66,7 @@
 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);