aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2022-01-06 00:59:40 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2022-01-06 00:59:40 +0100
commitb5b67241e043e9d5e11a5a21f00b9afe7e795282 (patch)
tree87ec9e7e3cb099ce340644051efff48113e1c421
parentf1dd97cb9cb7010fe070221108f95c2113894166 (diff)
downloadprosody-b5b67241e043e9d5e11a5a21f00b9afe7e795282.tar.gz
prosody-b5b67241e043e9d5e11a5a21f00b9afe7e795282.zip
mod_bookmarks: Override the node configuration if it was wrong
-rw-r--r--plugins/mod_bookmarks.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/mod_bookmarks.lua b/plugins/mod_bookmarks.lua
index a7cf695d..718fc018 100644
--- a/plugins/mod_bookmarks.lua
+++ b/plugins/mod_bookmarks.lua
@@ -176,6 +176,26 @@ local function publish_to_pep(jid, bookmarks, synchronise)
else
module:log("debug", "Got existing bookmarks2.");
bookmarks2 = ret;
+
+ local ok, err = service:get_node_config(namespace, jid);
+ if not ok then
+ module:log("error", "Retrieving bookmarks 2 node config failed: %s", err);
+ return ok, err;
+ end
+
+ local options = err;
+ for key, value in pairs(default_options) do
+ if options[key] and options[key] ~= value then
+ module:log("warn", "Overriding bookmarks 2 configuration for %s, from %s to %s", jid, options[key], value);
+ options[key] = value;
+ end
+ end
+
+ local ok, err = service:set_node_config(namespace, jid, options);
+ if not ok then
+ module:log("error", "Setting bookmarks 2 node config failed: %s", err);
+ return ok, err;
+ end
end
-- Get a list of all items we may want to remove.