diff options
author | Badlop <badlop@process-one.net> | 2010-12-03 17:23:24 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2010-12-03 17:26:12 +0100 |
commit | aa413d63dabd34109a0ca489d7432df3b902f469 (patch) | |
tree | 495d056e6aea75087c33387d4163447d8d44ebc1 /src | |
parent | Update example extauth script with tryregister, removeuser and removeuser3 (E... (diff) |
Fix detection of mod_last at server start (EJAB-641)
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_auth_external.erl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ejabberd_auth_external.erl b/src/ejabberd_auth_external.erl index 6f18b391..5415d003 100644 --- a/src/ejabberd_auth_external.erl +++ b/src/ejabberd_auth_external.erl @@ -66,7 +66,7 @@ check_cache_last_options(Server) -> case get_cache_option(Server) of false -> no_cache; {true, _CacheTime} -> - case get_mod_last_enabled(Server) of + case get_mod_last_configured(Server) of no_mod_last -> ?ERROR_MSG("In host ~p extauth is used, extauth_cache is enabled but " "mod_last is not enabled.", [Server]), @@ -295,10 +295,22 @@ get_last_info(User, Server) -> %% @spec (Server) -> mod_last | mod_last_odbc | no_mod_last get_mod_last_enabled(Server) -> - ML = lists:member(mod_last, gen_mod:loaded_modules(Server)), - MLO = lists:member(mod_last_odbc, gen_mod:loaded_modules(Server)), + ML = gen_mod:is_loaded(Server, mod_last), + MLO = gen_mod:is_loaded(Server, mod_last_odbc), case {ML, MLO} of {true, _} -> mod_last; {false, true} -> mod_last_odbc; {false, false} -> no_mod_last end. + +get_mod_last_configured(Server) -> + ML = is_configured(Server, mod_last), + MLO = is_configured(Server, mod_last_odbc), + case {ML, MLO} of + {true, _} -> mod_last; + {false, true} -> mod_last_odbc; + {false, false} -> no_mod_last + end. + +is_configured(Host, Module) -> + lists:keymember(Module, 1, ejabberd_config:get_local_option({modules, Host})). |