equal
deleted
inserted
replaced
1 local http = require "net.http"; |
1 local http = require "net.http"; |
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 local dataform = require "util.dataforms".new; |
|
6 |
5 |
7 local local_domain = module:get_host(); |
6 local local_domain = module:get_host(); |
8 local service = module:get_option(module.name .. "_service") or "pubsub." .. local_domain; |
7 local service = module:get_option(module.name .. "_service") or "pubsub." .. local_domain; |
9 local node = module:get_option(module.name .. "_node") or "serverinfo"; |
8 local node = module:get_option(module.name .. "_node") or "serverinfo"; |
10 local actor = module.host .. "/modules/" .. module.name; |
9 local actor = module.host .. "/modules/" .. module.name; |
27 end |
26 end |
28 ) |
27 ) |
29 |
28 |
30 module:add_feature("urn:xmpp:serverinfo:0"); |
29 module:add_feature("urn:xmpp:serverinfo:0"); |
31 |
30 |
32 module:add_extension(dataform { |
31 module:add_item("server-info-fields", { |
33 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/network/serverinfo" }, |
32 { name = "serverinfo-pubsub-node", type = "text-single", value = ("xmpp:%s?;node=%s"):format(service, node) }; |
34 { name = "serverinfo-pubsub-node", type = "text-single" }, |
33 }); |
35 }:form({ ["serverinfo-pubsub-node"] = ("xmpp:%s?;node=%s"):format(service, node) }, "result")); |
|
36 |
34 |
37 if cache_ttl < publication_interval then |
35 if cache_ttl < publication_interval then |
38 module:log("warn", "It is recommended to have a cache interval higher than the publication interval"); |
36 module:log("warn", "It is recommended to have a cache interval higher than the publication interval"); |
39 end |
37 end |
40 |
38 |