mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Fix mod_conversejs crash when mod_register not enabled (#3824)
This commit is contained in:
parent
75ffce0417
commit
0e25f8d43e
@ -183,10 +183,19 @@ get_register_options(Server) ->
|
||||
(_) -> false
|
||||
end,
|
||||
ejabberd_auth:auth_modules(Server)),
|
||||
Modules = mod_register_opt:allow_modules(Server),
|
||||
Modules = get_register_modules(Server),
|
||||
ModRegisterAllowsMe = (Modules == all) orelse lists:member(?MODULE, Modules),
|
||||
[{<<"allow_registration">>, AuthSupportsRegister and ModRegisterAllowsMe}].
|
||||
|
||||
get_register_modules(Server) ->
|
||||
try mod_register_opt:allow_modules(Server)
|
||||
catch
|
||||
error:{module_not_loaded, mod_register, _} ->
|
||||
?DEBUG("mod_conversejs couldn't get mod_register configuration for "
|
||||
"vhost ~p: module not loaded in that vhost.", [Server]),
|
||||
[]
|
||||
end.
|
||||
|
||||
get_extra_options(Host) ->
|
||||
RawOpts = gen_mod:get_module_opt(Host, ?MODULE, conversejs_options),
|
||||
lists:map(fun({Name, <<"true">>}) -> {Name, true};
|
||||
|
Loading…
Reference in New Issue
Block a user