Changeset

11583:4ee7a6a8753e

mod_server_contact_info: Apply JID normalization
author Kim Alvefur <zash@zash.se>
date Fri, 11 Sep 2020 18:34:06 +0200
parents 11582:a3d48204ec95
children 11584:8bea29d1f82d
files plugins/mod_server_contact_info.lua spec/scansion/prosody.cfg.lua spec/scansion/server_contact_info.scs
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_server_contact_info.lua	Fri Jan 22 00:11:39 2021 +0100
+++ b/plugins/mod_server_contact_info.lua	Fri Sep 11 18:34:06 2020 +0200
@@ -7,6 +7,7 @@
 --
 
 local array = require "util.array";
+local jid = require "util.jid";
 
 -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
 local form_layout = require "util.dataforms".new({
@@ -24,7 +25,7 @@
 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);
+	admin = array.collect( admins / jid.prep / function(admin) return "xmpp:" .. admin; end);
 });
 
 module:add_extension(form_layout:form(contact_config, "result"));
--- a/spec/scansion/prosody.cfg.lua	Fri Jan 22 00:11:39 2021 +0100
+++ b/spec/scansion/prosody.cfg.lua	Fri Sep 11 18:34:06 2020 +0200
@@ -124,8 +124,10 @@
 
 Component "conference.localhost" "muc"
 	storage = "memory"
+	admins = { "Admin@localhost" }
 	modules_enabled = {
 		"muc_mam";
+		"server_contact_info";
 	}
 
 
--- a/spec/scansion/server_contact_info.scs	Fri Jan 22 00:11:39 2021 +0100
+++ b/spec/scansion/server_contact_info.scs	Fri Sep 11 18:34:06 2020 +0200
@@ -53,4 +53,29 @@
 		</query>
 	</iq>
 
+
+Romeo sends:
+	<iq type='get' id='lx2' to='conference.localhost'>
+		<query xmlns='http://jabber.org/protocol/disco#info'/>
+	</iq>
+
+	<iq from='localhost' id='lx2' type='result'>
+		<query xmlns='http://jabber.org/protocol/disco#info' scansion:strict='false'>
+			<x xmlns='jabber:x:data' type='result'>
+				<field type='hidden' var='FORM_TYPE'>
+					<value>http://jabber.org/network/serverinfo</value>
+				</field>
+				<field type='list-multi' var='abuse-addresses'/>
+				<field type='list-multi' var='admin-addresses'>
+					<value>xmpp:admin@localhost</value>
+				</field>
+				<field type='list-multi' var='feedback-addresses'/>
+				<field type='list-multi' var='sales-addresses'/>
+				<field type='list-multi' var='security-addresses'/>
+				<field type='list-multi' var='status-addresses'/>
+				<field type='list-multi' var='support-addresses'/>
+			</x>
+		</query>
+	</iq>
+
 Romeo disconnects