Diff

core/usermanager.lua @ 5094:e646c849d72f

core.usermanager: Don't close sessions ourselves when deleting users. Instead, fire an event that modules can hook.
author Kim Alvefur <zash@zash.se>
date Sat, 25 Aug 2012 01:20:13 +0200
parent 5042:ce823b32225e
child 5129:e8253c931166
line wrap: on
line diff
--- a/core/usermanager.lua	Tue Aug 21 21:10:54 2012 +0200
+++ b/core/usermanager.lua	Sat Aug 25 01:20:13 2012 +0200
@@ -90,14 +90,9 @@
 end
 
 function delete_user(username, host)
-	local user = hosts[host].sessions[username];
-	if user and user.sessions then
-		for jid, session in pairs(user.sessions) do
-			session:close{ condition = "not-authorized", text = "Account deleted" };
-		end
-	end
 	local ok, err = hosts[host].users.delete_user(username);
 	if not ok then return nil, err; end
+	prosody.events.fire_event("user-deleted", { username = username, host = host });
 	return storagemanager.get_driver(host):purge(username);
 end