Software /
code /
prosody
Changeset
12152:0939675955f1
mod_bookmarks: Override the node configuration if it was wrong
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 06 Jan 2022 00:59:40 +0100 |
parents | 12151:669d93f1db6a |
children | 12153:26af75c20163 |
files | plugins/mod_bookmarks.lua |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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.