aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-24 13:43:13 +0100
committerKim Alvefur <zash@zash.se>2021-11-24 13:43:13 +0100
commit7683221a64cd152d1ed06552c9003bb4f6f9182f (patch)
tree60ce8ae51a33dcd4c4621f6968b8c56f00e5ca7d /plugins
parent6e91f0ad43d4b429274ba035a149b4a4493ae4ba (diff)
downloadprosody-7683221a64cd152d1ed06552c9003bb4f6f9182f.tar.gz
prosody-7683221a64cd152d1ed06552c9003bb4f6f9182f.zip
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.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_external_services.lua4
1 files changed, 4 insertions, 0 deletions
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;