Changeset

13306:939df56a51ba

mod_muc: Add :list-rooms permission
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Nov 2023 11:10:38 +0000
parents 13305:852a61c720d0
children 13307:8fb8a253f0a1
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Sun Nov 05 16:10:40 2023 +0100
+++ b/plugins/muc/mod_muc.lua	Tue Nov 07 11:10:38 2023 +0000
@@ -350,8 +350,12 @@
 end
 
 module:hook("host-disco-items", function(event)
+	module:log("debug", "host-disco-items called");
+	if not module:could(":list-rooms", event) then
+		module:log("debug", "Returning empty room list to unauthorized request");
+		return;
+	end
 	local reply = event.reply;
-	module:log("debug", "host-disco-items called");
 	if next(room_items_cache) ~= nil then
 		for jid, room_name in pairs(room_items_cache) do
 			if room_name == "" then room_name = nil; end