Software /
code /
prosody-modules
Diff
mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua @ 5921:896e7c7bf87f
Merge
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Tue, 30 Apr 2024 15:07:06 -0500 |
parent | 5910:2c85397d7241 |
child | 5941:5c4e102e2563 |
line wrap: on
line diff
--- a/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 30 15:06:03 2024 -0500 +++ b/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 30 15:07:06 2024 -0500 @@ -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_string(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_number(module.name .. "_publication_interval", 300); +local cache_ttl = module:get_option_number(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()