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
commit1d400b6d80c689a3d6fcfcde0d588e18941f00d2 (patch)
treea30563b696d1958c0ba12f488dba707be6fb52c5
parentcf05074f0e625bd001fb79c44efd787c0d8f333f (diff)
downloadprosody-1d400b6d80c689a3d6fcfcde0d588e18941f00d2.tar.gz
prosody-1d400b6d80c689a3d6fcfcde0d588e18941f00d2.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