2 local json = require "util.json"; |
2 local json = require "util.json"; |
3 local st = require "util.stanza"; |
3 local st = require "util.stanza"; |
4 local new_id = require"util.id".medium; |
4 local new_id = require"util.id".medium; |
5 |
5 |
6 local local_domain = module:get_host(); |
6 local local_domain = module:get_host(); |
7 local service = module:get_option(module.name .. "_service") or "pubsub." .. local_domain; |
7 local service = module:get_option_string(module.name .. "_service"); |
8 local node = module:get_option(module.name .. "_node") or "serverinfo"; |
8 local node = module:get_option_integer(module.name .. "_node", "serverinfo"); |
9 local actor = module.host .. "/modules/" .. module.name; |
9 local actor = module.host .. "/modules/" .. module.name; |
10 local publication_interval = module:get_option(module.name .. "_publication_interval") or 300; |
10 local publication_interval = module:get_option_integer(module.name .. "_publication_interval", 300); |
11 local cache_ttl = module:get_option(module.name .. "_cache_ttl") or 3600; |
11 local cache_ttl = module:get_option_integer(module.name .. "_cache_ttl", 3600); |
12 local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json"); |
12 local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json"); |
13 local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false); |
13 local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false); |
14 local persist_items = module:get_option_boolean(module.name.."_persist_items", true); |
14 local persist_items = module:get_option_boolean(module.name.."_persist_items", true); |
|
15 |
|
16 if not service and prosody.hosts["pubsub."..module.host] then |
|
17 service = "pubsub."..module.host; |
|
18 else |
|
19 module:log_status("warn", "No pubsub service specified - module not activated"); |
|
20 return; |
|
21 end |
15 |
22 |
16 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; |
23 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; |
17 |
24 |
18 function module.load() |
25 function module.load() |
19 discover_node():next( |
26 discover_node():next( |