Mercurial > prosody-hg
comparison plugins/mod_server_contact_info.lua @ 11584:8bea29d1f82d
mod_server_contact_info: Generate properly escaped URIs from 'admins'
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 11 Sep 2020 18:34:36 +0200 |
| parents | 4ee7a6a8753e |
| children | 74b9e05af71e |
comparison
equal
deleted
inserted
replaced
| 11583:4ee7a6a8753e | 11584:8bea29d1f82d |
|---|---|
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 local array = require "util.array"; | 9 local array = require "util.array"; |
| 10 local jid = require "util.jid"; | 10 local jid = require "util.jid"; |
| 11 local url = require "socket.url"; | |
| 11 | 12 |
| 12 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo | 13 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo |
| 13 local form_layout = require "util.dataforms".new({ | 14 local form_layout = require "util.dataforms".new({ |
| 14 { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo"; }; | 15 { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo"; }; |
| 15 { name = "abuse", var = "abuse-addresses", type = "list-multi" }, | 16 { name = "abuse", var = "abuse-addresses", type = "list-multi" }, |
| 23 | 24 |
| 24 -- JIDs of configured service admins are used as fallback | 25 -- JIDs of configured service admins are used as fallback |
| 25 local admins = module:get_option_inherited_set("admins", {}); | 26 local admins = module:get_option_inherited_set("admins", {}); |
| 26 | 27 |
| 27 local contact_config = module:get_option("contact_info", { | 28 local contact_config = module:get_option("contact_info", { |
| 28 admin = array.collect( admins / jid.prep / function(admin) return "xmpp:" .. admin; end); | 29 admin = array.collect(admins / jid.prep / function(admin) return url.build({scheme = "xmpp"; path = admin}); end); |
| 29 }); | 30 }); |
| 30 | 31 |
| 31 module:add_extension(form_layout:form(contact_config, "result")); | 32 module:add_extension(form_layout:form(contact_config, "result")); |
