Changeset

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
parents 5093:1ce9e8068dda
children 5095:dddbcd62183a
files core/usermanager.lua
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
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