Diff

plugins/muc/muc.lib.lua @ 1824:8e66c9d09f81

MUC: Refactored to remove some duplicate code.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 25 Sep 2009 12:35:09 +0500
parent 1819:ed1911be26c7
child 1825:f67e4bfc62f1
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Thu Sep 24 23:47:16 2009 +0100
+++ b/plugins/muc/muc.lib.lua	Fri Sep 25 12:35:09 2009 +0500
@@ -113,17 +113,8 @@
 	if code then
 		stanza:tag("status", {code=code}):up();
 	end
-	local me;
-	for occupant, o_data in pairs(self._occupants) do
-		if occupant ~= stanza.attr.from then
-			for jid in pairs(o_data.sessions) do
-				stanza.attr.to = jid;
-				self:route_stanza(stanza);
-			end
-		else
-			me = o_data;
-		end
-	end
+	self:broadcast_except_nick(stanza, stanza.attr.from);
+	local me = self._occupants[stanza.attr.from];
 	if me then
 		stanza:tag("status", {code='110'});
 		for jid in pairs(me.sessions) do