From 7683221a64cd152d1ed06552c9003bb4f6f9182f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 24 Nov 2021 13:43:13 +0100 Subject: 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. --- plugins/mod_external_services.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_external_services.lua b/plugins/mod_external_services.lua index 6b46f890..6daa45c7 100644 --- a/plugins/mod_external_services.lua +++ b/plugins/mod_external_services.lua @@ -63,12 +63,16 @@ local function prepare(item) 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; -- cgit v1.2.3