From 96c62acb1b9c6b307ec37a1ad1041589c2b7375a Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 5 May 2015 12:46:21 +0200 Subject: [PATCH] Improve get_last command to provide also last activity status --- src/mod_admin_extra.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index 12270a54a..75233a732 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -435,7 +435,7 @@ commands() -> result = {res, rescode}}, #ejabberd_commands{name = get_last, tags = [last], - desc = "Get last activity information", + desc = "Get last activity information (timestamp and status)", longdesc = "Timestamp is the seconds since" "1970-01-01 00:00:00 UTC, for example: date +%s", module = ?MODULE, function = get_last, @@ -1226,7 +1226,7 @@ get_last(User, Server) -> case Mod:get_last_info(User, Server) of not_found -> "Never"; - {ok, Shift, _Status} -> + {ok, Shift, Status} -> TimeStamp = {Shift div 1000000, Shift rem 1000000, 0}, @@ -1234,8 +1234,8 @@ get_last(User, Server) -> 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])) + "~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w ~s", + [Year, Month, Day, Hour, Minute, Second, Status])) end; _ -> "Online"