Comparison

plugins/mod_pep.lua @ 12089:76b4e3f12b53 0.11 0.11.11

mod_pep: Wipe pubsub service on user deletion 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.
author Kim Alvefur <zash@zash.se>
date Thu, 04 Nov 2021 01:00:06 +0100
parent 12088:e5028f6eb599
child 12091:7a48ccb084dd
comparison
equal deleted inserted replaced
12088:e5028f6eb599 12089:76b4e3f12b53
465 465
466 for node, node_obj in pairs(ret) do 466 for node, node_obj in pairs(ret) do
467 reply:tag("item", { jid = user_bare, node = node, name = node_obj.config.title }):up(); 467 reply:tag("item", { jid = user_bare, node = node, name = node_obj.config.title }):up();
468 end 468 end
469 end); 469 end);
470
471 module:hook_global("user-deleted", function(event)
472 if event.host ~= host then return end
473 local username = event.username;
474 local service = services[username];
475 if not service then return end
476 for node in pairs(service.nodes) do service:delete(node, true); end
477
478 local item = pep_service_items[username];
479 pep_service_items[username] = nil;
480 if item then module:remove_item("pep-service", item); end
481
482 recipients[username] = nil;
483 end);
484