Comparison

mod_rest/jsonmap.lib.lua @ 4841:f69c5a443156

mod_rest: Fix nested message stanzas in XEP-0297 containers It's all a bit awkward because it doesn't normally use the whole schema directly, but rather checks which stanza type is used and picks out that property as a schema. Which also prevents references from working.
author Kim Alvefur <zash@zash.se>
date Wed, 29 Dec 2021 19:40:28 +0100
parent 4803:f74c7c518bb2
child 4915:1d231fb827d3
comparison
equal deleted inserted replaced
4840:e9b7c8db3ebd 4841:f69c5a443156
16 copyto.properties[key] = prop; 16 copyto.properties[key] = prop;
17 end 17 end
18 end 18 end
19 schema.properties.message.properties.archive.properties.forward = schema.properties.message.properties.forwarded; 19 schema.properties.message.properties.archive.properties.forward = schema.properties.message.properties.forwarded;
20 schema.properties.message.properties.forwarded.properties.delay = schema._common.delay; 20 schema.properties.message.properties.forwarded.properties.delay = schema._common.delay;
21 schema.properties.message.properties.forwarded.properties.message.properties = schema.properties.message.properties; 21 schema.properties.message.properties.forwarded.properties.message = schema.properties.message;
22 schema.properties.iq.properties.archive.properties.form = schema._common.dataform; 22 schema.properties.iq.properties.archive.properties.form = schema._common.dataform;
23 schema.properties.iq.properties.archive.properties.page = schema._common.rsm; 23 schema.properties.iq.properties.archive.properties.page = schema._common.rsm;
24 schema.properties.iq.properties.result.properties.page = schema._common.rsm; 24 schema.properties.iq.properties.result.properties.page = schema._common.rsm;
25 schema._common = nil; 25 schema._common = nil;
26 end 26 end
534 archive["before"] = nil; 534 archive["before"] = nil;
535 archive["max"] = nil; 535 archive["max"] = nil;
536 end 536 end
537 end 537 end
538 538
539 local s = map.unparse(schema.properties[kind or "message"], t); 539 local s = map.unparse(schema, { [kind or "message"] = t }).tags[1];
540 540
541 s.attr.type = t_type; 541 s.attr.type = t_type;
542 s.attr.to = str(t.to) and jid.prep(t.to); 542 s.attr.to = str(t.to) and jid.prep(t.to);
543 s.attr.from = str(t.to) and jid.prep(t.from); 543 s.attr.from = str(t.to) and jid.prep(t.from);
544 544