Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
11932:92925f1320e7 | 11933:f752427a5214 |
---|---|
61 module:log("error", "Service missing mandatory 'type' field: %q", item); | 61 module:log("error", "Service missing mandatory 'type' field: %q", item); |
62 return nil; | 62 return nil; |
63 end | 63 end |
64 if type(item.transport) == "string" then | 64 if type(item.transport) == "string" then |
65 srv.transport = item.transport; | 65 srv.transport = item.transport; |
66 else | |
67 module:log("warn", "Service missing recommended 'transport' field: %q", item); | |
66 end | 68 end |
67 if type(item.host) == "string" then | 69 if type(item.host) == "string" then |
68 srv.host = item.host; | 70 srv.host = item.host; |
69 end | 71 end |
70 if type(item.port) == "number" then | 72 if type(item.port) == "number" then |
71 srv.port = item.port; | 73 srv.port = item.port; |
74 elseif not srv.port then | |
75 module:log("warn", "Service missing recommended 'port' field: %q", item); | |
72 end | 76 end |
73 if type(item.username) == "string" then | 77 if type(item.username) == "string" then |
74 srv.username = item.username; | 78 srv.username = item.username; |
75 end | 79 end |
76 if type(item.password) == "string" then | 80 if type(item.password) == "string" then |