aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-01 18:09:13 +0100
committerKim Alvefur <zash@zash.se>2019-11-01 18:09:13 +0100
commite4fe222fb68c3d73fa9045e9d5357a87bef8ded9 (patch)
treea30563b696d1958c0ba12f488dba707be6fb52c5
parent95f7ce5e3d4c81517210149170663bf3dadec024 (diff)
downloadprosody-e4fe222fb68c3d73fa9045e9d5357a87bef8ded9.tar.gz
prosody-e4fe222fb68c3d73fa9045e9d5357a87bef8ded9.zip
mod_register_ibr: Allow registartion rejection reason as util.error object
-rw-r--r--plugins/mod_register_ibr.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_register_ibr.lua b/plugins/mod_register_ibr.lua
index 2f220658..32e6f710 100644
--- a/plugins/mod_register_ibr.lua
+++ b/plugins/mod_register_ibr.lua
@@ -168,8 +168,15 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event)
module:fire_event("user-registering", user);
if not user.allowed then
log("debug", "Registration disallowed by module: %s", user.reason or "no reason given");
- -- TODO This could use util.error
- session.send(st.error_reply(stanza, user.error_type or "modify", user.error_condition or "not-acceptable", user.reason));
+ local error_type, error_condition, reason;
+ local err = user.error;
+ if err then
+ error_type, error_condition, reason = err.type, err.condition, err.text;
+ else
+ -- COMPAT pre-util.error
+ error_type, error_condition, reason = user.error_type, user.error_condition, user.reason;
+ end
+ session.send(st.error_reply(stanza, error_type or "modify", error_condition or "not-acceptable", reason));
return true;
end