From ce04878f1f11a301cc065119af9b6d595296f10e Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 11 Jul 2018 03:27:18 +0200
Subject: MUC: Remove room state on successful restoration from disk

---
 plugins/muc/mod_muc.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'plugins/muc')

diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 71b39eab..8cf6d23c 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -188,7 +188,12 @@ local function restore_room(jid)
 			module:log("debug", "Could not restore state of room %s: %s", jid, s_err);
 		end
 		local room = muclib.restore_room(data, state);
-		return track_room(room);
+		if track_room(room) then
+			room_state:set(node, nil);
+			return room;
+		else
+			return false;
+		end
 	elseif err then
 		module:log("error", "Error restoring room %s from storage: %s", jid, err);
 		local room = muclib.new_room(jid, { locked = math.huge });
-- 
cgit v1.2.3