mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Improve get_last command to provide also last activity status
This commit is contained in:
parent
77e57afae1
commit
96c62acb1b
@ -435,7 +435,7 @@ commands() ->
|
|||||||
result = {res, rescode}},
|
result = {res, rescode}},
|
||||||
|
|
||||||
#ejabberd_commands{name = get_last, tags = [last],
|
#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"
|
longdesc = "Timestamp is the seconds since"
|
||||||
"1970-01-01 00:00:00 UTC, for example: date +%s",
|
"1970-01-01 00:00:00 UTC, for example: date +%s",
|
||||||
module = ?MODULE, function = get_last,
|
module = ?MODULE, function = get_last,
|
||||||
@ -1226,7 +1226,7 @@ get_last(User, Server) ->
|
|||||||
case Mod:get_last_info(User, Server) of
|
case Mod:get_last_info(User, Server) of
|
||||||
not_found ->
|
not_found ->
|
||||||
"Never";
|
"Never";
|
||||||
{ok, Shift, _Status} ->
|
{ok, Shift, Status} ->
|
||||||
TimeStamp = {Shift div 1000000,
|
TimeStamp = {Shift div 1000000,
|
||||||
Shift rem 1000000,
|
Shift rem 1000000,
|
||||||
0},
|
0},
|
||||||
@ -1234,8 +1234,8 @@ get_last(User, Server) ->
|
|||||||
calendar:now_to_local_time(TimeStamp),
|
calendar:now_to_local_time(TimeStamp),
|
||||||
lists:flatten(
|
lists:flatten(
|
||||||
io_lib:format(
|
io_lib:format(
|
||||||
"~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w",
|
"~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w ~s",
|
||||||
[Year, Month, Day, Hour, Minute, Second]))
|
[Year, Month, Day, Hour, Minute, Second, Status]))
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
"Online"
|
"Online"
|
||||||
|
Loading…
Reference in New Issue
Block a user