mod_muc: Remove room from memory when it is made non-persistent and is empty
authorMatthew Wild <mwild1@gmail.com>
Wed, 4 May 2011 22:12:53 +0000 (23:12 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 4 May 2011 22:12:53 +0000 (23:12 +0100)
plugins/muc/mod_muc.lua

index 329b927022f7ca33e4916c5a0acdbe92492fe576..ca2e6e20a522a9d59f546b013ec3777544fadf7c 100644 (file)
@@ -58,6 +58,9 @@ local function room_save(room, forced)
                room._data.history = history;
        elseif forced then
                datamanager.store(node, muc_host, "config", nil);
+               if not next(room._occupants) then -- Room empty
+                       rooms[room.jid] = nil;
+               end
        end
        if forced then datamanager.store(nil, muc_host, "persistent", persistent_rooms); end
 end