comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 4671:98bf0f597df4

mod_storage_xmlarchive: Stop exporting XEP-0091 timestamp in conversion
author Kim Alvefur <zash@zash.se>
date Sat, 04 Sep 2021 14:56:04 +0200
parents 62d41447615d
children 79ba1a1a75cc
comparison
equal deleted inserted replaced
4670:1b81b7269858 4671:98bf0f597df4
490 data = st.preserialize(data); 490 data = st.preserialize(data);
491 data.key = item.id; 491 data.key = item.id;
492 data.with = item.with; 492 data.with = item.with;
493 data.when = tonumber(item.when) or dt.parse(item.when); 493 data.when = tonumber(item.when) or dt.parse(item.when);
494 data.attr.stamp = item.when; 494 data.attr.stamp = item.when;
495 data.attr.stamp_legacy = dt.legacy(data.when);
496 assert(dm.list_append(user, host, store, data)); 495 assert(dm.list_append(user, host, store, data));
497 end 496 end
498 assert(os.remove(dm.getpath(user .. "@" .. date, host, store, "list"))); 497 assert(os.remove(dm.getpath(user .. "@" .. date, host, store, "list")));
499 assert(os.remove(dm.getpath(user .. "@" .. date, host, store, "xml"))); 498 assert(os.remove(dm.getpath(user .. "@" .. date, host, store, "xml")));
500 end 499 end
523 dayitems = {}; 522 dayitems = {};
524 date = current_date; 523 date = current_date;
525 table.insert(dates, date); 524 table.insert(dates, date);
526 xmlfile = assert(io.open(dm.getpath(user .. "@" .. date, host, store, "xml"), "w")); 525 xmlfile = assert(io.open(dm.getpath(user .. "@" .. date, host, store, "xml"), "w"));
527 end 526 end
527 -- The property 'stamp_legacy' originally came from mod_offline and
528 -- was inherited into the mod_storage_internal archive format for
529 -- compat. It should not be needed since Prosody 0.10.0 but could
530 -- exist in older data.
528 item.attr.stamp, item.attr.stamp_legacy = nil, nil; 531 item.attr.stamp, item.attr.stamp_legacy = nil, nil;
529 local stanza = tostring(st.deserialize(item)) .. "\n"; 532 local stanza = tostring(st.deserialize(item)) .. "\n";
530 meta.offset, meta.length = xmlfile:seek(), #stanza; 533 meta.offset, meta.length = xmlfile:seek(), #stanza;
531 assert(xmlfile:write(stanza)); 534 assert(xmlfile:write(stanza));
532 table.insert(dayitems, meta); 535 table.insert(dayitems, meta);