Diff

plugins/muc/mod_muc.lua @ 8661:7fc0784491ef

MUC: Override methods on broken rooms to return internal-server-error instead
author Kim Alvefur <zash@zash.se>
date Thu, 22 Mar 2018 20:08:32 +0100
parent 8660:3b54f8472b51
child 8662:a4e63b037a2a
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Wed Mar 07 17:53:52 2018 +0100
+++ b/plugins/muc/mod_muc.lua	Thu Mar 22 20:08:32 2018 +0100
@@ -153,6 +153,12 @@
 	return false;
 end
 
+local function handle_broken_room(room, origin, stanza)
+	module:log("debug", "Returning error from broken room %s", room.jid);
+	origin.send(st.error_reply(stanza, "wait", "internal-server-error"));
+	return true;
+end
+
 local function restore_room(jid)
 	local node = jid_split(jid);
 	local data, err = room_configs:get(node);
@@ -167,6 +173,8 @@
 	elseif err then
 		module:log("error", "Error restoring room %s from storage: %s", jid, err);
 		local room = muclib.new_room(jid, { locked = math.huge });
+		room.handle_normal_presence = handle_broken_room;
+		room.handle_first_presence = handle_broken_room;
 		return room;
 	end
 end