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.
--- 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