MUC: Discard non-persistent rooms as soon as they become empty.

Wed, 09 Sep 2009 19:28:36 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 09 Sep 2009 19:28:36 +0500
changeset 1767
649dd3439809
parent 1766
b039538b9428
child 1768
802c40384dd0

MUC: Discard non-persistent rooms as soon as they become empty.

plugins/muc/mod_muc.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/mod_muc.lua	Wed Sep 09 19:17:29 2009 +0500
+++ b/plugins/muc/mod_muc.lua	Wed Sep 09 19:28:36 2009 +0500
@@ -114,6 +114,9 @@
 				rooms[bare] = room;
 			end
 			room:handle_stanza(origin, stanza);
+			if not next(room._occupants) and not persistent_rooms[room.jid] then -- empty, non-persistent room
+				rooms[bare] = nil; -- discard room
+			end
 		else --[[not for us?]] end
 		return;
 	end

mercurial