From 9f51add3a83cd0bbc6c765ce08cda1a4a42fc8a2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 26 Jul 2022 00:39:16 +0200 Subject: mod_storage_sql: Fix bypass of load procedure under prosodyctl There's no 'prosody.prosodyctl' property other than this one, introduced in 6216743c188c in 2015. Guessing that the intent was to skip this when running as a prosodyctl command. The module.command code does its own version of this initialization, so this seems likely. Thanks raja for noticing --- plugins/mod_storage_sql.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index 3bfe1739..448eaa2d 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -833,7 +833,7 @@ local function normalize_params(params) end function module.load() - if prosody.prosodyctl then return; end + if prosody.process_type == "prosodyctl" then return; end local engines = module:shared("/*/sql/connections"); local params = normalize_params(module:get_option("sql", default_params)); local db_uri = sql.db2uri(params); -- cgit v1.2.3 From 96301b2229b2ceeab1797e4bc4e29707b0a32681 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 26 Jul 2022 23:44:33 +0200 Subject: 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. --- plugins/mod_bookmarks.lua | 6 +++++- spec/scansion/empty_bookmarks.scs | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 spec/scansion/empty_bookmarks.scs diff --git a/plugins/mod_bookmarks.lua b/plugins/mod_bookmarks.lua index cd6eae67..d67915f8 100644 --- a/plugins/mod_bookmarks.lua +++ b/plugins/mod_bookmarks.lua @@ -87,7 +87,11 @@ local function on_retrieve_legacy_pep(event) 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 diff --git a/spec/scansion/empty_bookmarks.scs b/spec/scansion/empty_bookmarks.scs new file mode 100644 index 00000000..3ea4fe71 --- /dev/null +++ b/spec/scansion/empty_bookmarks.scs @@ -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: + + + + + + +Romeo receives: + + + + + + +Romeo disconnects + +# recording ended on 2022-07-26T21:40:45Z -- cgit v1.2.3