aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-08-25 01:29:38 +0200
committerKim Alvefur <zash@zash.se>2012-08-25 01:29:38 +0200
commita8d9cebe3c1a14d8a4b280272aa7b37e6906a214 (patch)
tree5fbb46fd50b06f87cadbc28bf30ca9a0b9b47148 /plugins
parent1e65e68cacacc39102f325cffb8bd5b8d7bad377 (diff)
downloadprosody-a8d9cebe3c1a14d8a4b280272aa7b37e6906a214.tar.gz
prosody-a8d9cebe3c1a14d8a4b280272aa7b37e6906a214.zip
mod_register: Hijack the session close call to send the final iq reply when deleting
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_register.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index a621b9a9..dfc8c49b 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -96,16 +96,22 @@ local function handle_registration_stanza(event)
else -- stanza.attr.type == "set"
if query.tags[1] and query.tags[1].name == "remove" then
local username, host = session.username, session.host;
+
+ local old_session_close = session.close;
+ session.close = function(session, ...)
+ session.send(st.reply(stanza));
+ return old_session_close(session, ...);
+ end
local ok, err = usermanager_delete_user(username, host);
if not ok then
module:log("debug", "Removing user account %s@%s failed: %s", username, host, err);
+ session.close = old_session_close;
session.send(st.error_reply(stanza, "cancel", "service-unavailable", err));
return true;
end
- session.send(st.reply(stanza));
module:log("info", "User removed their account: %s@%s", username, host);
module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session });
else