# HG changeset patch # User Emmanuel Gil Peyrot # Date 1641427180 -3600 # Node ID 0939675955f1816d5f71707ee6cca9dfe05a4165 # Parent 669d93f1db6af05bcd9dd4042777ed44feae3bbb mod_bookmarks: Override the node configuration if it was wrong diff -r 669d93f1db6a -r 0939675955f1 plugins/mod_bookmarks.lua --- a/plugins/mod_bookmarks.lua Wed Jan 05 22:37:42 2022 +0100 +++ b/plugins/mod_bookmarks.lua Thu Jan 06 00:59:40 2022 +0100 @@ -176,6 +176,26 @@ 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.