Changeset

3743:5eab799b5fa4

mod_bookmarks2: Delete legacy PEP bookmarks whenever they get recreated, to prevent them from being used.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 13 Nov 2019 16:54:36 +0100
parents 3742:05bca7a771d6
children 3744:1cfc8012a76f
files mod_bookmarks2/mod_bookmarks2.lua
diffstat 1 files changed, 5 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mod_bookmarks2/mod_bookmarks2.lua	Wed Nov 13 16:45:48 2019 +0100
+++ b/mod_bookmarks2/mod_bookmarks2.lua	Wed Nov 13 16:54:36 2019 +0100
@@ -276,26 +276,13 @@
 	if node ~= "storage:bookmarks" then
 		return;
 	end
-	local ok, node_config = service:get_node_config(node, actor);
+
+	module:log("debug", "Something tried to create legacy PEP bookmarks for %s.", actor);
+	local ok, err = service:delete("storage:bookmarks", actor);
 	if not ok then
-		module:log("error", "Failed to get node config of %s: %s", node, node_config);
-		return;
+		module:log("error", "Failed to delete legacy PEP bookmarks for %s: %s", actor, err);
 	end
-	local changed = false;
-	for config_field, value in pairs(default_options) do
-		if node_config[config_field] ~= value then
-			node_config[config_field] = value;
-			changed = true;
-		end
-	end
-	if not changed then
-		return;
-	end
-	local ok, err = service:set_node_config(node, actor, node_config);
-	if not ok then
-		module:log("error", "Failed to set node config of %s: %s", node, err);
-		return;
-	end
+	module:log("debug", "Legacy PEP bookmarks node of %s deleted.", actor);
 end
 
 module:hook("iq/bare/jabber:iq:private:query", function (event)