Changeset

5884:fdff8cb54302

mod_report_forward: fix address detection when there are multiple field values
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Mon, 11 Mar 2024 19:28:19 -0500
parents 5883:259ffdbf8906
children 5885:c20a0c8a54ea
files mod_report_forward/mod_report_forward.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_report_forward/mod_report_forward.lua	Tue Mar 05 18:26:29 2024 +0000
+++ b/mod_report_forward/mod_report_forward.lua	Mon Mar 11 19:28:19 2024 -0500
@@ -41,9 +41,11 @@
 		local field_var = select(i, ...);
 		local field = form:get_child_with_attr("field", nil, "var", field_var);
 		if field then
-			local parsed = url.parse(field:get_child_text("value"));
-			if parsed.scheme == "xmpp" and parsed.path and not parsed.query then
-				return parsed.path;
+			for value in field:childtags("value") do
+				local parsed = url.parse(value:get_text());
+				if parsed.scheme == "xmpp" and parsed.path and not parsed.query then
+					return parsed.path;
+				end
 			end
 		else
 			module:log("debug", "No field '%s'", field_var);