Software /
code /
prosody
Diff
plugins/mod_c2s.lua @ 5097:6c52a7a881cc
mod_c2s: When a user gets deleted, drop all their sessions
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Aug 2012 01:28:38 +0200 |
parent | 5013:ab693eea0869 |
child | 5120:bcabea740c00 |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Sat Aug 25 01:27:23 2012 +0200 +++ b/plugins/mod_c2s.lua Sat Aug 25 01:28:38 2012 +0200 @@ -169,6 +169,16 @@ 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);