Software /
code /
prosody-modules
Changeset
3112:ed948c75e53e
mod_server_contact_info: Remove
Does not with 0.9.x because of #983
Included with 0.10.x
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 09 Jun 2018 21:19:54 +0200 |
parents | 3111:7a3ac037e57f |
children | 3113:8298b06e6603 |
files | mod_server_contact_info/README.markdown mod_server_contact_info/mod_server_contact_info.lua |
diffstat | 2 files changed, 0 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_server_contact_info/README.markdown Fri Jun 08 21:59:42 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ ---- -labels: -- 'Stage-Beta' -summary: Contact Addresses for XMPP Services ---- - -Introduction -============ - -This module lets you advertise various contact addresses for your XMPP -service via [XEP-0157]. - -Configuration -============= - -Various types of contact addresses can be set via the single table -option `contact_info`. Each field is either a string or a list of -strings. Each string should be an URI. - -An example showing all possible fields: - -``` {.lua} -contact_info = { - abuse = { "mailto:abuse@shakespeare.lit", "xmpp:abuse@shakespeare.lit" }; - admin = { "mailto:admin@shakespeare.lit", "xmpp:admin@shakespeare.lit" }; - feedback = { "http://shakespeare.lit/feedback.php", "mailto:feedback@shakespeare.lit", "xmpp:feedback@shakespeare.lit" }; - sales = { "xmpp:bard@shakespeare.lit" }; - security = { "xmpp:security@shakespeare.lit" }; - support = { "http://shakespeare.lit/support.php", "xmpp:support@shakespeare.lit" }; -}; -``` - -If not set, the `admins` option will be used. - -Compatibility -============= - - ------ --------------- - 0.10 works - 0.9 works - 0.8 does not work - ------ ---------------
--- a/mod_server_contact_info/mod_server_contact_info.lua Fri Jun 08 21:59:42 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ --- XEP-0157: Contact Addresses for XMPP Services for Prosody --- --- Copyright (C) 2011-2016 Kim Alvefur --- --- This file is MIT/X11 licensed. --- - -local t_insert = table.insert; -local array = require "util.array"; -local df_new = require "util.dataforms".new; - --- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo -local valid_types = { - abuse = true; - admin = true; - feedback = true; - sales = true; - security = true; - support = true; -} - -local contact_config = module:get_option("contact_info"); -if not contact_config or not next(contact_config) then -- we'll use admins from the config as default - local admins = module:get_option_inherited_set("admins", {}); - if admins:empty() then - module:log("error", "No contact_info or admins set in config"); - return -- Nothing to attach, so we'll just skip it. - end - module:log("info", "No contact_info in config, using admins as fallback"); - contact_config = { - admin = array.collect( admins / function(admin) return "xmpp:" .. admin; end); - }; -end - -local form_layout = { - { value = "http://jabber.org/network/serverinfo"; type = "hidden"; name = "FORM_TYPE"; }; -}; - -local form_values = {}; - -for t in pairs(valid_types) do - local addresses = contact_config[t]; - if addresses then - t_insert(form_layout, { name = t .. "-addresses", type = "list-multi" }); - form_values[t .. "-addresses"] = addresses; - end -end - -module:add_extension(df_new(form_layout):form(form_values, "result"));