prosody/plugins/mod_server_contact_info.lua
Kim Alvefur b8e5c6c7a0 mod_server_contact_info: Simplify
This relies on the new name mapping in util.dataforms
2018-09-16 22:40:35 +02:00

27 lines
1.1 KiB
Lua

-- XEP-0157: Contact Addresses for XMPP Services for Prosody
--
-- Copyright (C) 2011-2016 Kim Alvefur
--
-- This file is MIT/X11 licensed.
--
local array = require "util.array";
-- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
local form_layout = require "util.dataforms".new({
{ var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo"; };
{ 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 = "support", var = "support-addresses", type = "list-multi" },
});
local admins = module:get_option_inherited_set("admins", {});
local contact_config = module:get_option("contact_info", {
admin = array.collect( admins / function(admin) return "xmpp:" .. admin; end);
});
module:add_extension(form_layout:form(contact_config, "result"));