aboutsummaryrefslogtreecommitdiffstats
path: root/core/usermanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-28 20:59:03 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-28 20:59:03 +0100
commit8aafe03289bdc2e8697bf72d226c4325ffc8d51f (patch)
tree57f657bdb5f9107ab5d46cd8ea6e0f18e7a20b11 /core/usermanager.lua
parent655defbb532f079c1476511db9c47b141a1d9792 (diff)
parent5e57a36957ea2d717865eefa2155c5dc854f8b4d (diff)
downloadprosody-8aafe03289bdc2e8697bf72d226c4325ffc8d51f.tar.gz
prosody-8aafe03289bdc2e8697bf72d226c4325ffc8d51f.zip
Merge with Zash
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r--core/usermanager.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 3aba5786..efc15b7c 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -10,11 +10,13 @@ local modulemanager = require "core.modulemanager";
local log = require "util.logger".init("usermanager");
local type = type;
local ipairs = ipairs;
+local pairs = pairs;
local jid_bare = require "util.jid".bare;
local jid_prep = require "util.jid".prep;
local config = require "core.configmanager";
local hosts = hosts;
local sasl_new = require "util.sasl".new;
+local storagemanager = require "core.storagemanager";
local prosody = _G.prosody;
@@ -88,7 +90,15 @@ function create_user(username, password, host)
end
function delete_user(username, host)
- return hosts[host].users.delete_user(username);
+ 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
+ return storagemanager.get_driver(host):purge(username);
end
function get_sasl_handler(host, session)