Software /
code /
prosody-modules
Comparison
mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 2041:7c61ab512d0b
mod_storage_xmlarchive: Return earlier if attempting to delete messages older than the oldest existing
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 02 Feb 2016 16:28:12 +0100 |
parent | 2040:459e1878d23c |
child | 2054:b7c528027762 |
comparison
equal
deleted
inserted
replaced
2040:459e1878d23c | 2041:7c61ab512d0b |
---|---|
185 local dates, err = dm.list_load(username, module.host, self.store); | 185 local dates, err = dm.list_load(username, module.host, self.store); |
186 if not dates or next(dates) == nil then | 186 if not dates or next(dates) == nil then |
187 if not err then return true end -- already empty | 187 if not err then return true end -- already empty |
188 return dates, err; | 188 return dates, err; |
189 end | 189 end |
190 if dates[1] > before then return true; end -- Nothing to delete | |
190 local remaining_dates = {}; | 191 local remaining_dates = {}; |
191 for d = 1, #dates do | 192 for d = 1, #dates do |
192 if dates[d] >= before then | 193 if dates[d] >= before then |
193 table.insert(remaining_dates, dates[d]); | 194 table.insert(remaining_dates, dates[d]); |
194 end | 195 end |