diff options
author | Matthew Wild <mwild1@gmail.com> | 2024-02-23 21:14:14 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2024-02-23 21:14:14 +0000 |
commit | fa5346d756c3733c42c0fafe50f56d0ca466d6af (patch) | |
tree | b75f7214598a85ecc135b243f1f8589ee74c77de /plugins | |
parent | 96898e05a628b865dc4c457e7345d404cfe2ae77 (diff) | |
download | prosody-fa5346d756c3733c42c0fafe50f56d0ca466d6af.tar.gz prosody-fa5346d756c3733c42c0fafe50f56d0ca466d6af.zip |
mod_server_contact_info: Update to publish fields via new mod_server_info
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_server_contact_info.lua | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/plugins/mod_server_contact_info.lua b/plugins/mod_server_contact_info.lua index b7f4c7f3..927f4c22 100644 --- a/plugins/mod_server_contact_info.lua +++ b/plugins/mod_server_contact_info.lua @@ -7,21 +7,21 @@ -- local array = require "prosody.util.array"; -local dataforms = require "prosody.util.dataforms"; local jid = require "prosody.util.jid"; local url = require "socket.url"; +module:depends("server_info"); + -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo -local form_layout = dataforms.new({ - { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo" }; - { type = "list-multi"; name = "abuse"; var = "abuse-addresses" }; - { type = "list-multi"; name = "admin"; var = "admin-addresses" }; - { type = "list-multi"; name = "feedback"; var = "feedback-addresses" }; - { type = "list-multi"; name = "sales"; var = "sales-addresses" }; - { type = "list-multi"; name = "security"; var = "security-addresses" }; - { type = "list-multi"; name = "status"; var = "status-addresses" }; - { type = "list-multi"; name = "support"; var = "support-addresses" }; -}); +local address_types = { + abuse = "abuse-addresses"; + admin = "admin-addresses"; + feedback = "feedback-addresses"; + sales = "sales-addresses"; + security = "security-addresses"; + status = "status-addresses"; + support = "support-addresses"; +}; -- JIDs of configured service admins are used as fallback local admins = module:get_option_inherited_set("admins", {}); @@ -30,4 +30,17 @@ local contact_config = module:get_option("contact_info", { admin = array.collect(admins / jid.prep / function(admin) return url.build({scheme = "xmpp"; path = admin}); end); }); -module:add_extension(form_layout:form(contact_config, "result")); +local fields = {}; + +for key, field_var in pairs(address_types) do + if contact_config[key] then + table.insert(fields, { + type = "list-multi"; + name = key; + var = field_var; + value = contact_config[key]; + }); + end +end + +module:add_item("server-info-fields", fields); |