changeset 13911:79ae4821c05e

mod_external_services: Allow custom XML content in service items
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Jun 2025 11:16:52 +0100
parents 622790951285
children a0faff6ba853
files plugins/mod_external_services.lua
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_external_services.lua	Fri Jun 27 11:12:50 2025 +0100
+++ b/plugins/mod_external_services.lua	Mon Jun 30 11:16:52 2025 +0100
@@ -101,6 +101,9 @@
 			srv.restricted = true;
 		end
 	end
+	if item.extra and st.is_stanza(item.extra) then
+		srv.extra = item.extra;
+	end
 	return srv;
 end
 
@@ -149,7 +152,11 @@
 				password = srv.password;
 				expires = srv.expires and dt.datetime(srv.expires) or nil;
 				restricted = srv.restricted and "1" or nil;
-			}):up();
+			});
+		if srv.extra then
+			reply:add_child(srv.extra);
+		end
+		reply:up();
 	end
 
 	return reply;
@@ -262,6 +269,7 @@
 			if not service_type or service_type:lower() == srv.type:lower() then
 				c = c + 1;
 				print(srv.type.." ("..srv.transport..")", srv.host..(srv.port and (":"..srv.port) or ""));
+				print(" auth:", srv.restricted and "required" or "none");
 				for _, prop in ipairs({ "username", "password", "expires" }) do
 					local val = srv[prop];
 					if val then
@@ -271,8 +279,9 @@
 						print(" "..prop..":", val);
 					end
 				end
-				if srv.restricted then
-					print(" restricted:", "yes");
+				if srv.extra then
+					print(" extra:");
+					print("    "..tostring(srv.extra:indent(3, "  ")));
 				end
 				print("");
 			end