plugins/muc/muc.lib: If decline is to person in room; route to all sessions
authordaurnimator <quae@daurnimator.com>
Thu, 27 Mar 2014 19:16:46 -0400
changeset 6143 82b3a2155a55
parent 6142 a6e526c00e6e
child 6144 cb08bba0443a
child 6179 e488a90195bc
plugins/muc/muc.lib: If decline is to person in room; route to all sessions
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Thu Mar 27 18:10:34 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Thu Mar 27 19:16:46 2014 -0400
@@ -1137,7 +1137,13 @@
 end
 
 module:hook("muc-decline", function(event)
-	event.room:_route_stanza(event.stanza);
+	local room, stanza = event.room, event.stanza
+	local occupant = room:get_occupant_by_real_jid(stanza.attr.to);
+	if occupant then
+		room:route_to_occupant(occupant, stanza)
+	else
+		room:route_stanza(stanza);
+	end
 	return true;
 end, -1)