diff mod_rest/jsonmap.lib.lua @ 4936:a85efae90e21

mod_rest: Expand mapping of XEP-0045 join stanza The previous 'join' mapping was apparently lost in translation when swithing to datamapper, so might as well map some properties allowing history control. Usually you probably want either zero history or history since the last known time of being joined. Maybe that the former should be the default?
author Kim Alvefur <zash@zash.se>
date Sat, 30 Apr 2022 01:00:01 +0200
parents 77b7e1322281
children b171ddf1bc3e
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Tue Apr 26 22:42:09 2022 +0200
+++ b/mod_rest/jsonmap.lib.lua	Sat Apr 30 01:00:01 2022 +0200
@@ -538,6 +538,11 @@
 		t.payload.data = json.encode(t.payload.data);
 	end
 
+	if kind == "presence" and t.join == true and t.muc == nil then
+		-- COMPAT Older boolean 'join' property used with XEP-0045
+		t.muc = {};
+	end
+
 	local s = map.unparse(schema, { [kind or "message"] = t }).tags[1];
 
 	s.attr.type = t_type;