diff options
author | Kim Alvefur <zash@zash.se> | 2019-08-23 01:15:44 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-08-23 01:15:44 +0200 |
commit | 9d5e31fd481a38bc7e346697cdacb8ef5cbd1ae5 (patch) | |
tree | ace6039a158a113bee6431bec2da2f621f663abe /plugins/mod_storage_internal.lua | |
parent | d3c559bcc89ef91ebecde3cc3b4520873a98ea4d (diff) | |
download | prosody-9d5e31fd481a38bc7e346697cdacb8ef5cbd1ae5.tar.gz prosody-9d5e31fd481a38bc7e346697cdacb8ef5cbd1ae5.zip |
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.
Diffstat (limited to 'plugins/mod_storage_internal.lua')
-rw-r--r-- | plugins/mod_storage_internal.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua index 1ee860d6..b3702fe1 100644 --- a/plugins/mod_storage_internal.lua +++ b/plugins/mod_storage_internal.lua @@ -218,13 +218,18 @@ function archive:summary(username, query) 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 |