Software /
code /
prosody
Changeset
10363:1010a1ff8d21
mod_register_ibr: Allow registartion rejection reason as util.error object
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Nov 2019 18:09:13 +0100 |
parents | 10362:c05444119e9e |
children | 10364:66943afdd7f3 |
files | plugins/mod_register_ibr.lua |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register_ibr.lua Wed Oct 30 17:33:52 2019 +0100 +++ b/plugins/mod_register_ibr.lua Fri Nov 01 18:09:13 2019 +0100 @@ -168,8 +168,15 @@ 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