changeset 4035:270cd50852be

mod_rest: Map xml:lang to/from JSON
author Kim Alvefur <zash@zash.se>
date Fri, 29 May 2020 12:04:04 +0200
parents a359972d246e
children 04c11b652aeb
files mod_rest/jsonmap.lib.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Tue May 26 21:32:55 2020 +0200
+++ b/mod_rest/jsonmap.lib.lua	Fri May 29 12:04:04 2020 +0200
@@ -13,6 +13,7 @@
 	to = "attr",
 	from = "attr",
 	id = "attr",
+	lang = "attr",
 
 	-- basic message
 	body = "text_tag",
@@ -444,6 +445,7 @@
 		to = s.attr.to,
 		from = s.attr.from,
 		id = s.attr.id,
+		lang = s.attr["xml:lang"],
 	};
 	if s.name == "presence" and not s.attr.type then
 		t.type = "available";
@@ -538,6 +540,7 @@
 		to = str(t.to) and jid.prep(t.to);
 		from = str(t.to) and jid.prep(t.from);
 		id = str(t.id),
+		["xml:lang"] = str(t.lang),
 	});
 
 	if t.to and not s.attr.to then