aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_memory.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-08-23 01:04:00 +0200
committerKim Alvefur <zash@zash.se>2019-08-23 01:04:00 +0200
commit24670cf607bf3eed29ca79dd4e6b7397773db91b (patch)
tree4a9ca9970994ac54d23d8733cebb86934d4bd0ea /plugins/mod_storage_memory.lua
parentf93754de4a3bc93dc7fd563eb570b358042ad693 (diff)
downloadprosody-24670cf607bf3eed29ca79dd4e6b7397773db91b.tar.gz
prosody-24670cf607bf3eed29ca79dd4e6b7397773db91b.zip
mod_storage_*: Tweak :summary API to allow future expansion with more fields
Eg might want to include last message, timestamp, chat state or other info.
Diffstat (limited to 'plugins/mod_storage_memory.lua')
-rw-r--r--plugins/mod_storage_memory.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/mod_storage_memory.lua b/plugins/mod_storage_memory.lua
index 376ae277..cac9bc40 100644
--- a/plugins/mod_storage_memory.lua
+++ b/plugins/mod_storage_memory.lua
@@ -170,11 +170,13 @@ end
function archive_store:summary(username, query)
local iter, err = self:find(username, query)
if not iter then return iter, err; end
- local summary = {};
+ local counts = {};
for _, _, _, with in iter do
- summary[with] = (summary[with] or 0) + 1;
+ counts[with] = (counts[with] or 0) + 1;
end
- return summary;
+ return {
+ counts = counts;
+ };
end