plugins/mod_pubsub/pubsub.lib.lua
changeset 8378 e2037634cdd9
parent 8377 b52663586243
child 8402 07443fe9df5b
--- a/plugins/mod_pubsub/pubsub.lib.lua	Mon Nov 06 21:03:30 2017 +0100
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Tue Nov 07 00:39:35 2017 +0100
@@ -490,6 +490,13 @@
 	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;