25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix mod_conversejs crash when mod_register not enabled (#3824)

This commit is contained in:
Badlop 2022-05-23 16:41:19 +02:00
parent 75ffce0417
commit 0e25f8d43e

View File

@ -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};