aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-08-25 01:28:38 +0200
committerKim Alvefur <zash@zash.se>2012-08-25 01:28:38 +0200
commit1e65e68cacacc39102f325cffb8bd5b8d7bad377 (patch)
tree447b17e5188671abdd6c4e1b9a6f3d3fb084da48 /plugins/mod_c2s.lua
parent091c29280a511aa2707fc27f9fcb24783bfbc255 (diff)
downloadprosody-1e65e68cacacc39102f325cffb8bd5b8d7bad377.tar.gz
prosody-1e65e68cacacc39102f325cffb8bd5b8d7bad377.zip
mod_c2s: When a user gets deleted, drop all their sessions
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 2318ecad..e9b24f69 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -169,6 +169,16 @@ local function session_close(session, reason)
end
end
+module:hook_global("user-deleted", function(event)
+ local username, host = event.username, event.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
+end, 200);
+
--- Port listener
function listener.onconnect(conn)
local session = sm_new_session(conn);