Diff

mod_report_forward/mod_report_forward.lua @ 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
parent 5881:ff90dad75352
child 5888:b5a110544fd4
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);