aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-09 02:10:44 +0100
committerKim Alvefur <zash@zash.se>2018-03-09 02:10:44 +0100
commit035cc595b96e6fe0cb7f87b0184a4b771f4686cc (patch)
tree288f3fd2cd77deeb0b009adac5ac4b52c777b7c1
parent89f519b0a56ee2fdd16069ab4e45ae73aa883e26 (diff)
downloadprosody-035cc595b96e6fe0cb7f87b0184a4b771f4686cc.tar.gz
prosody-035cc595b96e6fe0cb7f87b0184a4b771f4686cc.zip
MUC: Prevent creation of room that could not be loaded from storage (see #1091)
-rw-r--r--plugins/muc/mod_muc.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index bccd8915..b32515e8 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -112,15 +112,21 @@ end
local persistent_errors = false;
for jid in pairs(persistent_rooms) do
local node = jid_split(jid);
- local data = room_configs:get(node);
+ local data, err = room_configs:get(node);
if data then
local room = create_room(jid);
room._data = data._data;
room._affiliations = data._affiliations;
- else -- missing room data
+ elseif not err then -- missing room data
persistent_rooms[jid] = nil;
module:log("error", "Missing data for room '%s', removing from persistent room list", jid);
persistent_errors = true;
+ else -- error
+ module:log("error", "Error loading data for room '%s', locking it until service restart. Error was: %s", jid, err);
+ local room = muc_new_room(jid);
+ room.locked = true;
+ room._affiliations = { [muc_host] = "owner" }; -- To prevent unlocking
+ rooms[jid] = room;
end
end
if persistent_errors then persistent_rooms_storage:set(nil, persistent_rooms); end