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
commitca59dc04353ed8508b5cae3fdbcb9d62b7695273 (patch)
tree5fbb46fd50b06f87cadbc28bf30ca9a0b9b47148 /plugins
parent8e42f0b208e8a706bd2eb84988cf5cf4ddfee623 (diff)
downloadprosody-ca59dc04353ed8508b5cae3fdbcb9d62b7695273.tar.gz
prosody-ca59dc04353ed8508b5cae3fdbcb9d62b7695273.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