mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 06:07:37 +03:00
mod_server_contact_info: Update to publish fields via new mod_server_info
This commit is contained in:
parent
96898e05a6
commit
fa5346d756
1 changed files with 25 additions and 12 deletions
|
@ -7,21 +7,21 @@
|
||||||
--
|
--
|
||||||
|
|
||||||
local array = require "prosody.util.array";
|
local array = require "prosody.util.array";
|
||||||
local dataforms = require "prosody.util.dataforms";
|
|
||||||
local jid = require "prosody.util.jid";
|
local jid = require "prosody.util.jid";
|
||||||
local url = require "socket.url";
|
local url = require "socket.url";
|
||||||
|
|
||||||
|
module:depends("server_info");
|
||||||
|
|
||||||
-- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
|
-- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
|
||||||
local form_layout = dataforms.new({
|
local address_types = {
|
||||||
{ var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo" };
|
abuse = "abuse-addresses";
|
||||||
{ type = "list-multi"; name = "abuse"; var = "abuse-addresses" };
|
admin = "admin-addresses";
|
||||||
{ type = "list-multi"; name = "admin"; var = "admin-addresses" };
|
feedback = "feedback-addresses";
|
||||||
{ type = "list-multi"; name = "feedback"; var = "feedback-addresses" };
|
sales = "sales-addresses";
|
||||||
{ type = "list-multi"; name = "sales"; var = "sales-addresses" };
|
security = "security-addresses";
|
||||||
{ type = "list-multi"; name = "security"; var = "security-addresses" };
|
status = "status-addresses";
|
||||||
{ type = "list-multi"; name = "status"; var = "status-addresses" };
|
support = "support-addresses";
|
||||||
{ type = "list-multi"; name = "support"; var = "support-addresses" };
|
};
|
||||||
});
|
|
||||||
|
|
||||||
-- JIDs of configured service admins are used as fallback
|
-- JIDs of configured service admins are used as fallback
|
||||||
local admins = module:get_option_inherited_set("admins", {});
|
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);
|
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue