Software /
code /
prosody
Changeset
12593:1832b6c9c6ed 0.12
mod_bookmarks: Reduce error about not having bookmarks to debug (thanks tom)
This is happens if the account is new and doesn't have any bookmarks
yet, which is not a problem.
Rarely seen since most clients currently use the older version of
XEP-0084 stored in XEP-0049 rather than in PEP, but at least one
(Converse.js )does.
One scenario in which this would show up often is with Converse.js as a
guest chat using anonymous authentication, where all "accounts" would
always be new and not have any bookmarks. This scenario probably does
not need to have mod_bookmarks at all, but if enabled globally it would
likely become loaded onto the VirtualHost unless explicitly disabled.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Jul 2022 23:44:33 +0200 |
parents | 12592:d580e6a57cbb |
children | 12595:0572b6e604a3 12597:ba05f7e5f2a2 |
files | plugins/mod_bookmarks.lua spec/scansion/empty_bookmarks.scs |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_bookmarks.lua Tue Jul 26 00:39:16 2022 +0200 +++ b/plugins/mod_bookmarks.lua Tue Jul 26 23:44:33 2022 +0200 @@ -87,7 +87,11 @@ local service = mod_pep.get_pep_service(username); local ok, ret = service:get_items(namespace, session.full_jid); if not ok then - module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret); + if ret == "item-not-found" then + module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); + else + module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret); + end session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrieve bookmarks from PEP")); return true; end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spec/scansion/empty_bookmarks.scs Tue Jul 26 23:44:33 2022 +0200 @@ -0,0 +1,27 @@ +# mod_scansion_record on host 'localhost' recording started 2022-07-26T21:39:55Z + +[Client] Romeo + password: password + jid: juliet@localhost/UaksS4M1xYZB + +----- + +Romeo connects + +Romeo sends: + <iq xml:lang='en' type='get' id='bNBJLtpIJXpq'> + <pubsub xmlns='http://jabber.org/protocol/pubsub'> + <items node='storage:bookmarks'/> + </pubsub> + </iq> + +Romeo receives: + <iq id='bNBJLtpIJXpq' type='error'> + <error type='cancel'> + <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> + </error> + </iq> + +Romeo disconnects + +# recording ended on 2022-07-26T21:40:45Z