# HG changeset patch # User Kim Alvefur # Date 1628810614 -7200 # Node ID 37ca6109077f7288d74fbee00b239d0f2ad9e22c # Parent b91e40472d68d213dc1ed5d15913d273b37018d2 mod_storage_xmlarchive: Support full id range queries diff -r b91e40472d68 -r 37ca6109077f mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Fri Aug 13 01:37:15 2021 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Fri Aug 13 01:23:34 2021 +0200 @@ -25,6 +25,7 @@ archive.caps = { total = false, quota = nil, + full_id_range = true; }; local is_stanza = st.is_stanza or function (s) @@ -229,6 +230,7 @@ end local items; local first_item, last_item; + local stop_at_id; if rev then start_day, step, last_day = last_day, -step, start_day; if query.before then @@ -246,6 +248,9 @@ items = items_; end end + if query.after then + stop_at_id = query.after; + end elseif query.after then local after_day, after_item, items_ = self:_get_idx(username, query.after, dates); if not after_day then @@ -260,6 +265,11 @@ start_day = after_day; items = items_; end + if query.before then + stop_at_id = query.before; + end + elseif query.before then + stop_at_id = query.before; end local date_open, xmlfile; @@ -322,6 +332,11 @@ break; end + if stop_at_id and stop_at_id == item.id then + if xmlfile then xmlfile:close(); end + return; + end + if (not q_with or i_with == q_with) and (not q_start or i_when >= q_start) and (not q_end or i_when <= q_end) then