Software /
code /
prosody
Annotate
plugins/mod_server_contact_info.lua @ 13028:b2e6a175537d
mod_debug_reset: Don't delay operations until next tick
For some unknown reason, this was required with the old mock util.time
functions prior to 012d6e7b723a.
After 012d6e7b723a, it breaks. So I'm happy to revert to not delaying
anything. This makes tests pass again.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 06 Apr 2023 14:17:50 +0100 |
parent | 12981:d795e3bbc0e3 |
rev | line source |
---|---|
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 -- XEP-0157: Contact Addresses for XMPP Services for Prosody |
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 -- |
9334
a86736e0163c
mod_server_contact_info: Update copyright header
Kim Alvefur <zash@zash.se>
parents:
9333
diff
changeset
|
3 -- Copyright (C) 2011-2018 Kim Alvefur |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 -- |
9334
a86736e0163c
mod_server_contact_info: Update copyright header
Kim Alvefur <zash@zash.se>
parents:
9333
diff
changeset
|
5 -- This project is MIT/X11 licensed. Please see the |
a86736e0163c
mod_server_contact_info: Update copyright header
Kim Alvefur <zash@zash.se>
parents:
9333
diff
changeset
|
6 -- COPYING file in the source package for more information. |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 -- |
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 |
12977
74b9e05af71e
plugins: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents:
11584
diff
changeset
|
9 local array = require "prosody.util.array"; |
12981
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
10 local dataforms = require "prosody.util.dataforms"; |
12977
74b9e05af71e
plugins: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents:
11584
diff
changeset
|
11 local jid = require "prosody.util.jid"; |
11584
8bea29d1f82d
mod_server_contact_info: Generate properly escaped URIs from 'admins'
Kim Alvefur <zash@zash.se>
parents:
11583
diff
changeset
|
12 local url = require "socket.url"; |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 |
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo |
12981
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
15 local form_layout = dataforms.new({ |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
16 { var = "FORM_TYPE"; type = "hidden"; value = "http://jabber.org/network/serverinfo" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
17 { type = "list-multi"; name = "abuse"; var = "abuse-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
18 { type = "list-multi"; name = "admin"; var = "admin-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
19 { type = "list-multi"; name = "feedback"; var = "feedback-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
20 { type = "list-multi"; name = "sales"; var = "sales-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
21 { type = "list-multi"; name = "security"; var = "security-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
22 { type = "list-multi"; name = "status"; var = "status-addresses" }; |
d795e3bbc0e3
mod_server_contact_info: Reorder dataform keys for more aligned view
Kim Alvefur <zash@zash.se>
parents:
12977
diff
changeset
|
23 { type = "list-multi"; name = "support"; var = "support-addresses" }; |
9333
fd704adc62e1
mod_server_contact_info: Simplify
Kim Alvefur <zash@zash.se>
parents:
8257
diff
changeset
|
24 }); |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 |
9428
8e7feec95e8d
mod_server_contact_info: Comment on fallback to using 'admins'
Kim Alvefur <zash@zash.se>
parents:
9334
diff
changeset
|
26 -- JIDs of configured service admins are used as fallback |
9333
fd704adc62e1
mod_server_contact_info: Simplify
Kim Alvefur <zash@zash.se>
parents:
8257
diff
changeset
|
27 local admins = module:get_option_inherited_set("admins", {}); |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 |
9333
fd704adc62e1
mod_server_contact_info: Simplify
Kim Alvefur <zash@zash.se>
parents:
8257
diff
changeset
|
29 local contact_config = module:get_option("contact_info", { |
11584
8bea29d1f82d
mod_server_contact_info: Generate properly escaped URIs from 'admins'
Kim Alvefur <zash@zash.se>
parents:
11583
diff
changeset
|
30 admin = array.collect(admins / jid.prep / function(admin) return url.build({scheme = "xmpp"; path = admin}); end); |
9333
fd704adc62e1
mod_server_contact_info: Simplify
Kim Alvefur <zash@zash.se>
parents:
8257
diff
changeset
|
31 }); |
8257
c24837f57259
mod_server_contact_info: Import from prosody-modules 2c59f2f0c37d (fixes #778)
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 |
9333
fd704adc62e1
mod_server_contact_info: Simplify
Kim Alvefur <zash@zash.se>
parents:
8257
diff
changeset
|
33 module:add_extension(form_layout:form(contact_config, "result")); |