Changeset

8703:416b8ae3857d

MUC: Prevent creation of room that could not be loaded from storage (see #1091)
author Kim Alvefur <zash@zash.se>
date Fri, 09 Mar 2018 02:10:44 +0100
parents 8702:7e7aa0f770c7
children 8704:c0e812dd9dfc
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Wed Mar 07 16:01:58 2018 +0100
+++ b/plugins/muc/mod_muc.lua	Fri Mar 09 02:10:44 2018 +0100
@@ -112,15 +112,21 @@
 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