# HG changeset patch # User Matthew Wild # Date 1713267712 -3600 # Node ID 49b0873932ca9575d3a1f3486735d2c8d3806e95 # Parent 6c11e1b4066d040df279b01168b209482ad31318 mod_pubsub_serverinfo: Don't default to non-local pubsub servers (thanks roughnecks) diff -r 6c11e1b4066d -r 49b0873932ca mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua --- a/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 16 12:05:47 2024 +0100 +++ b/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 16 12:41:52 2024 +0100 @@ -4,15 +4,22 @@ local new_id = require"util.id".medium; local local_domain = module:get_host(); -local service = module:get_option(module.name .. "_service") or "pubsub." .. local_domain; -local node = module:get_option(module.name .. "_node") or "serverinfo"; +local service = module:get_option_string(module.name .. "_service"); +local node = module:get_option_integer(module.name .. "_node", "serverinfo"); local actor = module.host .. "/modules/" .. module.name; -local publication_interval = module:get_option(module.name .. "_publication_interval") or 300; -local cache_ttl = module:get_option(module.name .. "_cache_ttl") or 3600; +local publication_interval = module:get_option_integer(module.name .. "_publication_interval", 300); +local cache_ttl = module:get_option_integer(module.name .. "_cache_ttl", 3600); local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json"); local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false); local persist_items = module:get_option_boolean(module.name.."_persist_items", true); +if not service and prosody.hosts["pubsub."..module.host] then + service = "pubsub."..module.host; +else + module:log_status("warn", "No pubsub service specified - module not activated"); + return; +end + local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; function module.load()