25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Show the last activity time in the user page.

SVN Revision: 2861
This commit is contained in:
Badlop 2010-01-04 20:39:01 +00:00
parent 7a3ce2e81a
commit 3f1c8f98ed

View File

@ -1731,6 +1731,27 @@ user_info(User, Server, Query, Lang) ->
?INPUTT("submit", "chpassword", "Change Password")], ?INPUTT("submit", "chpassword", "Change Password")],
UserItems = ejabberd_hooks:run_fold(webadmin_user, list_to_binary(LServer), [], UserItems = ejabberd_hooks:run_fold(webadmin_user, list_to_binary(LServer), [],
[User, Server, Lang]), [User, Server, Lang]),
%% Code copied from list_given_users/5:
ModLast = get_lastactivity_module(Server),
LastActivity = case ejabberd_sm:get_user_resources(UserB, ServerB) of
[] ->
case ModLast:get_last_info(UserB, ServerB) of
not_found ->
?T("Never");
{ok, Shift, _Status} ->
TimeStamp = {Shift div 1000000,
Shift rem 1000000,
0},
{{Year, Month, Day}, {Hour, Minute, Second}} =
calendar:now_to_local_time(TimeStamp),
lists:flatten(
io_lib:format(
"~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w",
[Year, Month, Day, Hour, Minute, Second]))
end;
_ ->
?T("Online")
end,
[?XC('h1', ?T("User ") ++ us_to_list(US))] ++ [?XC('h1', ?T("User ") ++ us_to_list(US))] ++
case Res of case Res of
ok -> [?XREST("Submitted")]; ok -> [?XREST("Submitted")];
@ -1740,6 +1761,7 @@ user_info(User, Server, Query, Lang) ->
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)], [?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
[?XCT('h3', "Connected Resources:")] ++ FResources ++ [?XCT('h3', "Connected Resources:")] ++ FResources ++
[?XCT('h3', "Password:")] ++ FPassword ++ [?XCT('h3', "Password:")] ++ FPassword ++
[?XCT('h3', "Last Activity")] ++ [?C(LastActivity)] ++
UserItems ++ UserItems ++
[?P, ?INPUTT("submit", "removeuser", "Remove User")])]. [?P, ?INPUTT("submit", "removeuser", "Remove User")])].