aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-11-07 00:39:35 +0100
committerKim Alvefur <zash@zash.se>2017-11-07 00:39:35 +0100
commitd82e8c2080438c642fec4bb6915e09d1f7ef68c2 (patch)
treeab4834a555a39bd9a16a841cb30145b8207a6fad /plugins/mod_pubsub
parent90a6c4a9268cfa9ecf589debd5d47392cb54deca (diff)
downloadprosody-d82e8c2080438c642fec4bb6915e09d1f7ef68c2.tar.gz
prosody-d82e8c2080438c642fec4bb6915e09d1f7ef68c2.zip
mod_pubsub: Add a tail method (like util.cache) to archive_itemstore
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index c44801dd..ae99167f 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -490,6 +490,13 @@ local function archive_itemstore(archive, config, user, node)
function get_set:clear() -- luacheck: ignore 212/self
return archive:delete(user);
end
+ function get_set:tail()
+ -- This should conveniently return the last item
+ local item = self:get(nil);
+ if item then
+ return item.attr.id, item;
+ end
+ end
return setmetatable(get_set, archive);
end
_M.archive_itemstore = archive_itemstore;