Comparison

mod_rest/jsonmap.lib.lua @ 4935: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
parent 4927:77b7e1322281
child 4947:b171ddf1bc3e
comparison
equal deleted inserted replaced
4934:ae83200fb55f 4935:a85efae90e21
536 536
537 if type(t.payload) == "table" then 537 if type(t.payload) == "table" then
538 t.payload.data = json.encode(t.payload.data); 538 t.payload.data = json.encode(t.payload.data);
539 end 539 end
540 540
541 if kind == "presence" and t.join == true and t.muc == nil then
542 -- COMPAT Older boolean 'join' property used with XEP-0045
543 t.muc = {};
544 end
545
541 local s = map.unparse(schema, { [kind or "message"] = t }).tags[1]; 546 local s = map.unparse(schema, { [kind or "message"] = t }).tags[1];
542 547
543 s.attr.type = t_type; 548 s.attr.type = t_type;
544 s.attr.to = str(t.to) and jid.prep(t.to); 549 s.attr.to = str(t.to) and jid.prep(t.to);
545 s.attr.from = str(t.to) and jid.prep(t.from); 550 s.attr.from = str(t.to) and jid.prep(t.from);