diff options
| author | Badlop <badlop@process-one.net> | 2007-11-27 18:54:06 +0000 |
|---|---|---|
| committer | Badlop <badlop@process-one.net> | 2007-11-27 18:54:06 +0000 |
| commit | eb330ac0e0db29c6e6dc4108f33490dec349d0b9 (patch) | |
| tree | 503d45b661c1bd60852c3b0aa8db1cfb7f59cd7e /src/mod_configure.erl | |
| parent | * doc/guide.tex: Document ejabberd_http's (diff) | |
* src/mod_configure.erl: The command get-user-lastlogin is now
compatible with both Mnesia and ODBC (EJAB-383)
* src/mod_last.erl: Likewise
* src/mod_last_odbc.erl: Likewise
SVN Revision: 995
Diffstat (limited to 'src/mod_configure.erl')
| -rw-r--r-- | src/mod_configure.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mod_configure.erl b/src/mod_configure.erl index 24f40b33c..e49dc7007 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -1606,11 +1606,11 @@ set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) -> case ejabberd_sm:get_user_resources(User, Server) of [] -> US = {User, Server}, - case mnesia:dirty_read({last_activity, US}) of - [] -> + case get_last_info(User, Server) of + not_found -> ?T(Lang, "Never"); - [E] -> - Shift = element(3, E), + {ok, Timestamp, _Status} -> + Shift = Timestamp, TimeStamp = {Shift div 1000000, Shift rem 1000000, 0}, @@ -1711,6 +1711,16 @@ stop_node(From, Host, ENode, Action, XData) -> {result, []}. +get_last_info(User, Server) -> + ML = lists:member(mod_last, gen_mod:loaded_modules(Server)), + MLO = lists:member(mod_last_odbc, gen_mod:loaded_modules(Server)), + case {ML, MLO} of + {true, _} -> mod_last:get_last_info(User, Server); + {false, true} -> mod_last_odbc:get_last_info(User, Server); + {false, false} -> not_found + end. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% adhoc_sm_commands(_Acc, From, |
