X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmuc%2Fmod_muc.lua;h=5b342c02c2c21ef5083306f51c604edb75cff8e3;hb=5b075d344de23f2689782f4a435262e4dfb46110;hp=c50567e911f0a7f57313805363815f38762440d8;hpb=57a8c4f15c43bbe68b65b021aebd22c0df515c7e;p=prosody.git diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index c50567e9..5b342c02 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -97,15 +97,15 @@ local room_configs = module:open_store("config"); local room_items_cache = {}; -local function room_save(room, forced) +local function room_save(room, forced, savestate) local node = jid_split(room.jid); local is_persistent = persistent.get(room); room_items_cache[room.jid] = room:get_public() and room:get_name() or nil; - if is_persistent or forced then + if is_persistent or savestate then persistent_rooms:set(nil, room.jid, true); - local data = room:freeze(forced); + local data = room:freeze(savestate); return room_configs:set(node, data); - else + elseif forced then persistent_rooms:set(nil, room.jid, nil); return room_configs:set(node, nil); end @@ -113,7 +113,7 @@ end local rooms = cache.new(module:get_option_number("muc_room_cache_size", 100), function (_, room) module:log("debug", "%s evicted", room); - room_save(room, true); -- Force to disk + room_save(room, nil, true); -- Force to disk end); -- Automatically destroy empty non-persistent rooms @@ -155,7 +155,7 @@ end function module.unload() for room in rooms:values() do - room:save(true); + room:save(nil, true); forget_room(room); end end @@ -287,7 +287,7 @@ end function shutdown_component() for room in each_room(true) do - room:save(true); + room:save(nil, true); end end module:hook_global("server-stopping", shutdown_component);