Software /
code /
prosody
Diff
plugins/mod_external_services.lua @ 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 |
parent | 11756:a0e17b7c8b05 |
child | 12431:95f33a006c03 |
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;