Changeset

4424:1cbf3744300c

MUC: Fix a possible stack overflow (when a local component joins a room, then disconnects, an unavailble-error presence cycle can occur).
author Waqas Hussain <waqas20@gmail.com>
date Mon, 21 Nov 2011 19:59:38 +0500
parents 4418:70b5e533325d
children 4425:6f5ed0f4a3e6 4469:500735931677
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Sat Nov 19 22:40:30 2011 +0000
+++ b/plugins/muc/muc.lib.lua	Mon Nov 21 19:59:38 2011 +0500
@@ -358,6 +358,7 @@
 		elseif type == "unavailable" then -- unavailable
 			if current_nick then
 				log("debug", "%s leaving %s", current_nick, room);
+				self._jid_nick[from] = nil;
 				local occupant = self._occupants[current_nick];
 				local new_jid = next(occupant.sessions);
 				if new_jid == from then new_jid = next(occupant.sessions, new_jid); end
@@ -382,7 +383,6 @@
 					self:broadcast_presence(pr, from);
 					self._occupants[current_nick] = nil;
 				end
-				self._jid_nick[from] = nil;
 			end
 		elseif not type then -- available
 			if current_nick then