diff options
author | Kim Alvefur <zash@zash.se> | 2016-04-29 16:54:45 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-04-29 16:54:45 +0200 |
commit | c4f4daa8a2bbe451ccdce6a8281d95a6acde70dc (patch) | |
tree | 1fe5344de5de5607753222bdae8341db44375b3f /plugins | |
parent | 47a1e0374cc0432e08b28b004fcecc9113d81643 (diff) | |
download | prosody-c4f4daa8a2bbe451ccdce6a8281d95a6acde70dc.tar.gz prosody-c4f4daa8a2bbe451ccdce6a8281d95a6acde70dc.zip |
MUC: Separate force-save parameter from save-entire-state flag
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/mod_muc.lua | 14 | ||||
-rw-r--r-- | plugins/muc/muc.lib.lua | 6 |
2 files changed, 10 insertions, 10 deletions
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); diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 9a7b1f85..eeb531a9 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -769,7 +769,7 @@ function room_mt:process_form(origin, stanza) end event.field, event.value = nil, nil; - self:save(); + self:save(true); origin.send(st.reply(stanza)); if next(event.status_codes) then @@ -852,7 +852,7 @@ function room_mt:handle_admin_query_set_command(origin, stanza) else success, errtype, err = nil, "cancel", "bad-request"; end - self:save(); + self:save(true); if not success then origin.send(st.error_reply(stanza, errtype, err)); else @@ -1219,7 +1219,7 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason) end end - self:save(); + self:save(true); module:fire_event("muc-set-affiliation", { room = self; |