Changeset

4731:d71beacaec3b

mod_rest: Apply JSON mapping to items in <xmpp> container (e.g. MAM results etc)
author Kim Alvefur <zash@zash.se>
date Wed, 27 Oct 2021 20:43:17 +0200
parents 4730:1da4b815d2fe
children 4732:607cac9b9393
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Wed Oct 27 19:12:03 2021 +0100
+++ b/mod_rest/jsonmap.lib.lua	Wed Oct 27 20:43:17 2021 +0200
@@ -406,6 +406,13 @@
 }
 
 local function st2json(s)
+	if s.name == "xmpp" then
+		local result = array();
+		for child in s:childtags() do
+			result:push(st2json(child));
+		end
+		return { xmpp = result };
+	end
 	local t = map.parse(schema.properties[s.name], s);
 
 	t.kind = s.name;