mod_blocklist: Check JID of mediated MUC invite sender against blocklist
authorMatthew Wild <mwild1@gmail.com>
Mon, 22 Apr 2024 11:26:20 +0100
changeset 13485 1c87c0a7ece6
parent 13484 3027c2634a44
child 13486 4d697961546d
mod_blocklist: Check JID of mediated MUC invite sender against blocklist This ensures that someone on your blocklist is unable to invite you to MUC rooms.
plugins/mod_blocklist.lua
--- a/plugins/mod_blocklist.lua	Wed Apr 17 16:47:38 2024 +0100
+++ b/plugins/mod_blocklist.lua	Mon Apr 22 11:26:20 2024 +0100
@@ -262,7 +262,22 @@
 	local to, from = attr.to, attr.from;
 	to = to and jid_split(to);
 	if to and from then
-		return is_blocked(to, from);
+		if is_blocked(to, from) then
+			return true;
+		end
+
+		-- Check mediated MUC inviter
+		if stanza.name == "message" then
+			local invite = stanza:find("{http://jabber.org/protocol/muc#user}x/invite");
+			if invite then
+				from = jid_prep(invite.attr.from);
+				if is_blocked(to, from) then
+					return true;
+				end
+			end
+		end
+
+		return false;
 	end
 end