aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
commit8e42f0b208e8a706bd2eb84988cf5cf4ddfee623 (patch)
tree447b17e5188671abdd6c4e1b9a6f3d3fb084da48 /plugins
parent8160ca4fc90592637e31c76fa700016d46636abd (diff)
downloadprosody-8e42f0b208e8a706bd2eb84988cf5cf4ddfee623.tar.gz
prosody-8e42f0b208e8a706bd2eb84988cf5cf4ddfee623.zip
mod_c2s: When a user gets deleted, drop all their sessions
Diffstat (limited to 'plugins')
-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);