From 567fc4966c2c555b1b649ef9c25c2abb14e592b8 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 25 Sep 2009 12:35:09 +0500 Subject: MUC: Refactored to remove some duplicate code. --- plugins/muc/muc.lib.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'plugins/muc') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 6917b21a..260ce422 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -113,17 +113,8 @@ function room_mt:broadcast_presence(stanza, code, nick) 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 -- cgit v1.2.3