Changeset

5803:f199bff16f1f

mod_audit_auth: Improve user-agent building (fixes traceback)
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Dec 2023 13:02:36 +0000
parents 5802:6ab9e1763f35
children 5804:cb25d341745f
files mod_audit_auth/mod_audit_auth.lua
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_audit_auth/mod_audit_auth.lua	Wed Dec 06 19:13:26 2023 +0000
+++ b/mod_audit_auth/mod_audit_auth.lua	Thu Dec 07 13:02:36 2023 +0000
@@ -27,9 +27,21 @@
 	local session, client = event.session, event.client;
 
 	local client_info = st.stanza("client", { id = client.id });
+
 	if client.user_agent then
-		client_info:text_tag("agent", client.user_agent);
+		local user_agent = st.stanza("user-agent", { xmlns = "urn:xmpp:sasl:2" })
+		if client.user_agent.software then
+			user_agent:text_tag("software", client.user_agent.software, { id = client.user_agent.software_id; version = client.user_agent.software_version });
+		end
+		if client.user_agent.device then
+			user_agent:text_tag("device", client.user_agent.device);
+		end
+		if client.user_agent.uri then
+			user_agent:text_tag("uri", client.user_agent.uri);
+		end
+		client_info:add_child(user_agent);
 	end
+
 	if client.legacy then
 		client_info:text_tag("legacy");
 	end