changeset 6306:093c47ee2041

mod_muc_rtbl: Simplify configuration and tweak docs
author Matthew Wild <mwild1@gmail.com>
date Thu, 31 Jul 2025 15:43:41 +0100
parents 1c0e9486ba23
children c194bec4b56d
files mod_muc_rtbl/README.md mod_muc_rtbl/mod_muc_rtbl.lua
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_rtbl/README.md	Thu Jul 31 15:12:51 2025 +0100
+++ b/mod_muc_rtbl/README.md	Thu Jul 31 15:43:41 2025 +0100
@@ -23,21 +23,26 @@
 }
 ```
 
-Then you should configure one or more lists you want to subscribe to:
+Then you should configure one or more lists you want to subscribe to, supplying
+full or partial URIs (the default node is 'muc_bans_sha256' if unspecified):
 
 ```lua
 muc_rtbls = {
+	"rtbl.example";
+	-- Equivalent to above
 	"xmpp:rtbl.example?;node=muc_bans_sha256";
 }
 ```
 
-If an unaffiliated JID matches an entry found in any of the configured lists,
+If an unaffiliated JID matches an entry found in any of the configured RTBLs,
 this module will block:
 
 - Joins
 - Group chat messages
 - Private messages
 
+from the JID that matched.
+
 # Compatibility
 
 Should work with Prosody >= 0.12.x
--- a/mod_muc_rtbl/mod_muc_rtbl.lua	Thu Jul 31 15:12:51 2025 +0100
+++ b/mod_muc_rtbl/mod_muc_rtbl.lua	Thu Jul 31 15:43:41 2025 +0100
@@ -23,7 +23,7 @@
 
 local function parse_xmpp_uri(uri)
 	local parsed = url.parse(uri);
-	if parsed.scheme ~= "xmpp" then
+	if parsed.scheme and parsed.scheme ~= "xmpp" then
 		return nil, "unexpected-scheme";
 	end
 
@@ -42,7 +42,7 @@
 for _, rtbl_uri in ipairs(rtbl_config) do
 	local uri = parse_xmpp_uri(rtbl_uri);
 	module:log("debug", "Subscribing to %q node %q", uri.jid, uri.params.node);
-	local rtbl = mod_rtbl.new_rtbl_subscription(uri.jid, uri.params.node, {});
+	local rtbl = mod_rtbl.new_rtbl_subscription(uri.jid, uri.params.node or "muc_bans_sha256", {});
 	table.insert(lists, rtbl);
 end