Comparison

plugins/mod_server_contact_info.lua @ 11583:4ee7a6a8753e

mod_server_contact_info: Apply JID normalization
author Kim Alvefur <zash@zash.se>
date Fri, 11 Sep 2020 18:34:06 +0200
parent 11010:6b27cb706b89
child 11584:8bea29d1f82d
comparison
equal deleted inserted replaced
11582:a3d48204ec95 11583:4ee7a6a8753e
5 -- This project is MIT/X11 licensed. Please see the 5 -- This project is MIT/X11 licensed. Please see the
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 11
11 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo 12 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
12 local form_layout = require "util.dataforms".new({ 13 local form_layout = require "util.dataforms".new({
13 { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo"; }; 14 { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo"; };
14 { name = "abuse", var = "abuse-addresses", type = "list-multi" }, 15 { name = "abuse", var = "abuse-addresses", type = "list-multi" },
22 23
23 -- JIDs of configured service admins are used as fallback 24 -- JIDs of configured service admins are used as fallback
24 local admins = module:get_option_inherited_set("admins", {}); 25 local admins = module:get_option_inherited_set("admins", {});
25 26
26 local contact_config = module:get_option("contact_info", { 27 local contact_config = module:get_option("contact_info", {
27 admin = array.collect( admins / function(admin) return "xmpp:" .. admin; end); 28 admin = array.collect( admins / jid.prep / function(admin) return "xmpp:" .. admin; end);
28 }); 29 });
29 30
30 module:add_extension(form_layout:form(contact_config, "result")); 31 module:add_extension(form_layout:form(contact_config, "result"));