aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-04 01:00:06 +0100
committerKim Alvefur <zash@zash.se>2021-11-04 01:00:06 +0100
commitca08584d742a8bca8c93547d189529752a8cc23d (patch)
tree1391a74a6be81d55d38ff6e91807d0e1a73c76a2 /plugins
parentdb0e630ad77bb5d1b725d06ae6f253214cbb92f7 (diff)
downloadprosody-ca08584d742a8bca8c93547d189529752a8cc23d.tar.gz
prosody-ca08584d742a8bca8c93547d189529752a8cc23d.zip
mod_pep: Wipe pubsub service on user deletion0.11.11
Data is already wiped from storage, but this ensures everything is properly unsubscribed, possibly with notifications etc. Clears recipient cache as well, since it is no longer relevant.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pep.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index a96bb1aa..4ee3db5e 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -467,3 +467,18 @@ module:hook("account-disco-items", function(event)
reply:tag("item", { jid = user_bare, node = node, name = node_obj.config.title }):up();
end
end);
+
+module:hook_global("user-deleted", function(event)
+ if event.host ~= host then return end
+ local username = event.username;
+ local service = services[username];
+ if not service then return end
+ for node in pairs(service.nodes) do service:delete(node, true); end
+
+ local item = pep_service_items[username];
+ pep_service_items[username] = nil;
+ if item then module:remove_item("pep-service", item); end
+
+ recipients[username] = nil;
+end);
+