aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-08-23 01:28:53 +0200
committerKim Alvefur <zash@zash.se>2019-08-23 01:28:53 +0200
commit81bcce711729db0d8b2983f8cec3d7a7bb7e22d4 (patch)
treeec9ccea9e04888a2ffcd27662491c520f07e1977
parentefd7a8c22603525106125df3e35a5cf64e76ec22 (diff)
downloadprosody-81bcce711729db0d8b2983f8cec3d7a7bb7e22d4.tar.gz
prosody-81bcce711729db0d8b2983f8cec3d7a7bb7e22d4.zip
mod_storage_internal: Include last text message
A protocol built on this API now allows showing a list of unread conversations with a counter, ordered by either oldest or newest message, along with the text body itself.
-rw-r--r--plugins/mod_storage_internal.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index b3702fe1..c8b902cf 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -220,17 +220,20 @@ function archive:summary(username, query)
local counts = {};
local earliest = {};
local latest = {};
- for _, _, when, with in iter do
+ local body = {};
+ for _, stanza, when, with in iter do
counts[with] = (counts[with] or 0) + 1;
if earliest[with] == nil then
earliest[with] = when;
end
latest[with] = when;
+ body[with] = stanza:get_child_text("body") or body[with];
end
return {
counts = counts;
earliest = earliest;
latest = latest;
+ body = body;
};
end