1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-06 03:50:15 +02:00

* 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
This commit is contained in:
Badlop 2007-11-27 18:54:06 +00:00
parent 0ef2886b7e
commit eb330ac0e0
4 changed files with 49 additions and 4 deletions

View file

@ -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,