Software /
code /
prosody
Diff
plugins/mod_storage_internal.lua @ 10222:51f145094648
mod_storage_*: Also include timestmap of first message in :summary API
For completeness along with most recent timestamp. Might be nice to be
able to order by oldest unread message.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Aug 2019 01:15:44 +0200 |
parent | 10221:068692cb9e78 |
child | 10223:d185c4961ee0 |
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua Fri Aug 23 01:10:27 2019 +0200 +++ b/plugins/mod_storage_internal.lua Fri Aug 23 01:15:44 2019 +0200 @@ -218,13 +218,18 @@ local iter, err = self:find(username, query) if not iter then return iter, err; end local counts = {}; + local earliest = {}; local latest = {}; for _, _, when, with in iter do counts[with] = (counts[with] or 0) + 1; + if earliest[with] == nil then + earliest[with] = when; + end latest[with] = when; end return { counts = counts; + earliest = earliest; latest = latest; }; end