aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bookmarks.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2024-11-08 10:31:25 +0000
committerMatthew Wild <mwild1@gmail.com>2024-11-08 10:31:25 +0000
commitef342f9734a4141b92b280040fd6180f4a30a5ae (patch)
tree861f976c3edf8e7b375c49c9e3df2646b107f522 /plugins/mod_bookmarks.lua
parent664895700d29b70c3e84cee0a19a86c9f262e511 (diff)
parentcf3403f90c03b000be389a196148fa4fe33cc8f1 (diff)
downloadprosody-ef342f9734a4141b92b280040fd6180f4a30a5ae.tar.gz
prosody-ef342f9734a4141b92b280040fd6180f4a30a5ae.zip
Merge 0.12->trunk
Diffstat (limited to 'plugins/mod_bookmarks.lua')
-rw-r--r--plugins/mod_bookmarks.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/mod_bookmarks.lua b/plugins/mod_bookmarks.lua
index be665d0f..e6e74f56 100644
--- a/plugins/mod_bookmarks.lua
+++ b/plugins/mod_bookmarks.lua
@@ -167,10 +167,15 @@ local function publish_to_pep(jid, bookmarks, synchronise)
if synchronise then
-- If we set zero legacy bookmarks, purge the bookmarks 2 node.
module:log("debug", "No bookmark in the set, purging instead.");
- return service:purge(namespace, jid, true);
- else
- return true;
+ local ok, err = service:purge(namespace, jid, true);
+ -- It's okay if no node exists when purging, user has
+ -- no bookmarks anyway.
+ if not ok and err ~= "item-not-found" then
+ module:log("error", "Failed to clear items from bookmarks 2 node: %s", err);
+ return ok, err;
+ end
end
+ return true;
end
-- Retrieve the current bookmarks2.
@@ -309,7 +314,7 @@ local function on_publish_legacy_pep(event)
local ok, err = publish_to_pep(session.full_jid, bookmarks, true);
if not ok then
- module:log("error", "Failed to publish to PEP bookmarks for %s@%s: %s", session.username, session.host, err);
+ module:log("error", "Failed to sync legacy bookmarks to PEP for %s@%s: %s", session.username, session.host, err);
session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP"));
return true;
end
@@ -335,7 +340,7 @@ local function on_publish_private_xml(event)
local ok, err = publish_to_pep(session.full_jid, bookmarks, true);
if not ok then
- module:log("error", "Failed to publish to PEP bookmarks for %s@%s: %s", session.username, session.host, err);
+ module:log("error", "Failed to sync private XML bookmarks to PEP for %s@%s: %s", session.username, session.host, err);
session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP"));
return true;
end