Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 8375:e2037634cdd9
mod_pubsub: Add a tail method (like util.cache) to archive_itemstore
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Nov 2017 00:39:35 +0100 |
parent | 8374:b52663586243 |
child | 8399:07443fe9df5b |
comparison
equal
deleted
inserted
replaced
8374:b52663586243 | 8375:e2037634cdd9 |
---|---|
488 return data; | 488 return data; |
489 end | 489 end |
490 function get_set:clear() -- luacheck: ignore 212/self | 490 function get_set:clear() -- luacheck: ignore 212/self |
491 return archive:delete(user); | 491 return archive:delete(user); |
492 end | 492 end |
493 function get_set:tail() | |
494 -- This should conveniently return the last item | |
495 local item = self:get(nil); | |
496 if item then | |
497 return item.attr.id, item; | |
498 end | |
499 end | |
493 return setmetatable(get_set, archive); | 500 return setmetatable(get_set, archive); |
494 end | 501 end |
495 _M.archive_itemstore = archive_itemstore; | 502 _M.archive_itemstore = archive_itemstore; |
496 | 503 |
497 return _M; | 504 return _M; |