plugins/muc/mod_muc.lua
changeset 12014 f995d62044fa
parent 11496 6da8d9cb355d
child 12112 e9882c4c397f
--- a/plugins/muc/mod_muc.lua	Sat Dec 04 17:46:37 2021 +0100
+++ b/plugins/muc/mod_muc.lua	Sun Dec 05 14:49:06 2021 +0100
@@ -538,10 +538,14 @@
 			end
 			return { status = "completed", error = { message = t_concat(errmsg, "\n") } };
 		end
-		for _, room in ipairs(fields.rooms) do
-			get_room_from_jid(room):destroy();
+		local destroyed = array();
+		for _, room_jid in ipairs(fields.rooms) do
+			local room = get_room_from_jid(room_jid);
+			if room and room:destroy() then
+				destroyed:push(room.jid);
+			end
 		end
-		return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(fields.rooms, "\n") };
+		return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(destroyed, "\n") };
 	end);
 	local destroy_rooms_desc = adhoc_new("Destroy Rooms",
 		"http://prosody.im/protocol/muc#destroy", destroy_rooms_handler, "admin");