Diff

plugins/mod_storage_internal.lua @ 10220:1e2b444acb72

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.
author Kim Alvefur <zash@zash.se>
date Fri, 23 Aug 2019 01:04:00 +0200
parent 10024:4a0d990253a0
child 10221:068692cb9e78
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Thu Aug 22 01:00:31 2019 +0200
+++ b/plugins/mod_storage_internal.lua	Fri Aug 23 01:04:00 2019 +0200
@@ -217,11 +217,13 @@
 function archive: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
 
 function archive:users()