Mercurial > prosody-modules
diff mod_bookmarks/mod_bookmarks.lua @ 3233:176b537a658c
mod_bookmarks: Send back empty Private XML bookmarks on empty PEP bookmarks.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 18 Aug 2018 14:43:58 +0100 |
parents | 34e30a891bd3 |
children | b1e25943a004 |
line wrap: on
line diff
--- a/mod_bookmarks/mod_bookmarks.lua Sat Aug 18 14:11:26 2018 +0100 +++ b/mod_bookmarks/mod_bookmarks.lua Sat Aug 18 14:43:58 2018 +0100 @@ -23,13 +23,18 @@ local username = session.username; local service = mod_pep.get_pep_service(username); - module:log("debug", "%s", 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 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 + if not id or not item then + module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", username); + session.send(st.reply(stanza):add_child(query)); + return + end + module:log("debug", "Got item %s: %s", id, item); local content = item.tags[1]; module:log("debug", "Sending back private for %s: %s", username, content);