# HG changeset patch # User Emmanuel Gil Peyrot # Date 1569763578 -7200 # Node ID 23b26a414d710b1b847fbcf96b1e913c82f6cdcd # Parent bcf61e22f84181e956a51c8f24ab0218cb18afea mod_register_ibr, mod_register_limits: Add support for custom error type and defined-condition. diff -r bcf61e22f841 -r 23b26a414d71 plugins/mod_register_ibr.lua --- a/plugins/mod_register_ibr.lua Sun Sep 29 15:51:21 2019 +0200 +++ b/plugins/mod_register_ibr.lua Sun Sep 29 15:26:18 2019 +0200 @@ -168,7 +168,7 @@ module:fire_event("user-registering", user); if not user.allowed then log("debug", "Registration disallowed by module: %s", user.reason or "no reason given"); - session.send(st.error_reply(stanza, "modify", "not-acceptable", user.reason)); + session.send(st.error_reply(stanza, user.error_type or "modify", user.error_condition or "not-acceptable", user.reason)); return true; end diff -r bcf61e22f841 -r 23b26a414d71 plugins/mod_register_limits.lua --- a/plugins/mod_register_limits.lua Sun Sep 29 15:51:21 2019 +0200 +++ b/plugins/mod_register_limits.lua Sun Sep 29 15:26:18 2019 +0200 @@ -64,15 +64,21 @@ log("debug", "Registration disallowed by blacklist"); event.allowed = false; event.reason = "Your IP address is blacklisted"; + event.error_type = "auth"; + event.error_condition = "forbidden"; elseif (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then log("debug", "Registration disallowed by whitelist"); event.allowed = false; event.reason = "Your IP address is not whitelisted"; + event.error_type = "auth"; + event.error_condition = "forbidden"; elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then if not check_throttle(ip) then log("debug", "Registrations over limit for ip %s", ip or "?"); event.allowed = false; event.reason = "Too many registrations from this IP address recently"; + event.error_type = "wait"; + event.error_condition = "policy-violation"; end end end);