mirror of
https://github.com/bjc/prosody.git
synced 2025-04-07 07:07:38 +03:00
mod_pubsub: Add a tail method (like util.cache) to archive_itemstore
This commit is contained in:
parent
5b91ff0bab
commit
3b0d35ed9a
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue