Software /
code /
prosody
Diff
plugins/muc/mod_muc.lua @ 7415:cbb05b454c13
MUC: Separate config from live state
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 29 Apr 2016 17:04:05 +0200 |
parent | 7414:1b62c89014c4 |
child | 7417:4c8ee8175f5e |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Fri Apr 29 16:54:45 2016 +0200 +++ b/plugins/muc/mod_muc.lua Fri Apr 29 17:04:05 2016 +0200 @@ -94,6 +94,7 @@ local persistent_rooms_storage = module:open_store("persistent"); local persistent_rooms = module:open_store("persistent", "map"); local room_configs = module:open_store("config"); +local room_state = module:open_store("state"); local room_items_cache = {}; @@ -103,10 +104,12 @@ room_items_cache[room.jid] = room:get_public() and room:get_name() or nil; if is_persistent or savestate then persistent_rooms:set(nil, room.jid, true); - local data = room:freeze(savestate); + local data, state = room:freeze(savestate); + room_state:set(node, state); return room_configs:set(node, data); elseif forced then persistent_rooms:set(nil, room.jid, nil); + room_state:set(node, nil); return room_configs:set(node, nil); end end @@ -133,8 +136,9 @@ local function restore_room(jid) local node = jid_split(jid); local data = room_configs:get(node); + local state = room_state:get(node); if data then - local room = muclib.restore_room(data); + local room = muclib.restore_room(data, state); track_room(room); return room; end