# HG changeset patch # User Florian Zeitz # Date 1349118440 -7200 # Node ID 39bb9344f194f81c3f0ecb266362c702709db404 # Parent 854f6d9aee2dfb536f2fe670104f21edaab74cd6 mod_register: Fire event to allow blocking user registration diff -r 854f6d9aee2d -r 39bb9344f194 plugins/mod_register.lua --- a/plugins/mod_register.lua Sat Sep 29 17:07:08 2012 +0100 +++ b/plugins/mod_register.lua Mon Oct 01 21:07:20 2012 +0200 @@ -223,6 +223,12 @@ local host = module.host; if not username or username == "" then session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid.")); + return true; + end + local user = { username = username , host = host, allowed = true } + module:fire_event("user-registering", user); + if not user.allowed then + session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is forbidden.")); elseif usermanager_user_exists(username, host) then session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists.")); else