# HG changeset patch # User Kim Alvefur # Date 1478695124 -3600 # Node ID 093b70378fa5381c7d69e49ad7315bada6ee1d6d # Parent 49a01b78b45fad8ae387805f9be513b08f012e88 mod_storage_muc_log: Separate out date collection into API method diff -r 49a01b78b45f -r 093b70378fa5 mod_storage_muc_log/mod_storage_muc_log.lua --- a/mod_storage_muc_log/mod_storage_muc_log.lua Wed Nov 09 13:37:58 2016 +0100 +++ b/mod_storage_muc_log/mod_storage_muc_log.lua Wed Nov 09 13:38:44 2016 +0100 @@ -67,7 +67,7 @@ return today .. "_" .. #data; end -function driver:find(node, query) +function driver:dates(node) local path = datamanager.getpath(node, host, datastore):match("(.*)/"); local ok, iter, state, var = pcall(lfs.dir, path); @@ -84,6 +84,12 @@ end if dates[1] == nil then return noop, 0; end table.sort(dates); + return dates; +end + +function driver:find(node, query) + local dates, err = self:dates(node); + if not dates then return dates, err; end return coroutine.wrap(function () local start_date = query and query.start and os_date(datef, query.start) or dates[1];