changeset 3230:ba0d444b64aa

mod_bookmarks: Simplify last item retrieval thanks to Prosody b6ffd4f951b9.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 18 Aug 2018 14:04:40 +0100
parents e8963e328b26
children f7777bc6e677
files mod_bookmarks/mod_bookmarks.lua
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mod_bookmarks/mod_bookmarks.lua	Sat Aug 18 13:48:45 2018 +0100
+++ b/mod_bookmarks/mod_bookmarks.lua	Sat Aug 18 14:04:40 2018 +0100
@@ -19,21 +19,14 @@
 		return;
 	end
 
-	module:log("debug", "Getting private %s", bookmarks);
+	module:log("debug", "Getting private bookmarks: %s", bookmarks);
 
 	local username = session.username;
 	local service = mod_pep.get_pep_service(username);
 	module:log("debug", "%s", session.full_jid);
-	local ok, id = service:get_last_item("storage:bookmarks", session.full_jid);
+	local ok, id, item = service:get_last_item("storage:bookmarks", session.full_jid);
 	if not ok then
-		module:log("error", "Failed to PEP bookmarks’ last id of %s: %s", username, id);
-		session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP"));
-		return;
-	end
-
-	local ok, data = service:get_items("storage:bookmarks", session.full_jid, id);
-	if not ok then
-		module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", username, data);
+		module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", username, id);
 		session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP"));
 		return;
 	end