Changeset

11933:f752427a5214

mod_external_services: Warn about missing recommended fields These are RECOMMENDED in XEP-0215 so most likely a mistake if they are left out. Of the two REQUIRED fields, 'host' falls back to module.host and 'type' rejects the whole item.
author Kim Alvefur <zash@zash.se>
date Wed, 24 Nov 2021 13:43:13 +0100
parents 11932:92925f1320e7
children 11934:65cdb1b21db3
files plugins/mod_external_services.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_external_services.lua	Wed Nov 24 20:12:22 2021 +0100
+++ b/plugins/mod_external_services.lua	Wed Nov 24 13:43:13 2021 +0100
@@ -63,12 +63,16 @@
 	end
 	if type(item.transport) == "string" then
 		srv.transport = item.transport;
+	else
+		module:log("warn", "Service missing recommended 'transport' field: %q", item);
 	end
 	if type(item.host) == "string" then
 		srv.host = item.host;
 	end
 	if type(item.port) == "number" then
 		srv.port = item.port;
+	elseif not srv.port then
+		module:log("warn", "Service missing recommended 'port' field: %q", item);
 	end
 	if type(item.username) == "string" then
 		srv.username = item.username;