aboutsummaryrefslogtreecommitdiff
path: root/src/mod_admin_extra.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_admin_extra.erl')
-rw-r--r--src/mod_admin_extra.erl31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl
index 49e6a9869..3687c1edf 100644
--- a/src/mod_admin_extra.erl
+++ b/src/mod_admin_extra.erl
@@ -70,7 +70,6 @@
push_alltoall/2,
%% mod_last
get_last/2,
- set_last/4,
%% mod_private
private_get/4,
private_set/3,
@@ -191,7 +190,7 @@ commands() ->
desc = "Check if the password hash is correct",
longdesc = "Allowed hash methods: md5, sha.",
module = ?MODULE, function = check_password_hash,
- args = [{user, binary}, {host, binary}, {passwordhash, binary}, {hashmethod, binary}],
+ args = [{user, binary}, {host, binary}, {passwordhash, string}, {hashmethod, string}],
result = {res, rescode}},
#ejabberd_commands{name = change_password, tags = [accounts],
desc = "Change the password of an account",
@@ -435,7 +434,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,
@@ -445,8 +444,8 @@ commands() ->
desc = "Set last activity information",
longdesc = "Timestamp is the seconds since"
"1970-01-01 00:00:00 UTC, for example: date +%s",
- module = ?MODULE, function = set_last,
- args = [{user, string}, {host, string}, {timestamp, integer}, {status, string}],
+ module = mod_last, function = store_last_info,
+ args = [{user, binary}, {host, binary}, {timestamp, integer}, {status, binary}],
result = {res, rescode}},
#ejabberd_commands{name = private_get, tags = [private],
@@ -680,7 +679,7 @@ delete_old_users(Days, Users) ->
%% If it isnt
[] ->
%% Look for his last_activity
- case (get_lastactivity_module(LServer)):get_last_info(LUser, LServer) of
+ case mod_last:get_last_info(LUser, LServer) of
%% If it is
%% existent:
{ok, TimeStamp, _Status} ->
@@ -714,13 +713,6 @@ delete_old_users(Days, Users) ->
Users_removed = lists:filter(F, Users),
{removed, length(Users_removed), Users_removed}.
-get_lastactivity_module(Server) ->
- case lists:member(mod_last, gen_mod:loaded_modules(Server)) of
- true -> mod_last;
- _ -> mod_last_odbc
- end.
-
-
%%
%% Ban account
@@ -1220,13 +1212,12 @@ build_broadcast(U, S, SubsAtom) when is_atom(SubsAtom) ->
%%%
get_last(User, Server) ->
- Mod = get_lastactivity_module(Server),
case ejabberd_sm:get_user_resources(User, Server) of
[] ->
- case Mod:get_last_info(User, Server) of
+ case mod_last:get_last_info(User, Server) of
not_found ->
"Never";
- {ok, Shift, _Status} ->
+ {ok, Shift, Status} ->
TimeStamp = {Shift div 1000000,
Shift rem 1000000,
0},
@@ -1234,17 +1225,13 @@ 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"
end.
-set_last(User, Server, Timestamp, Status) ->
- Mod = get_lastactivity_module(Server),
- Mod:store_last_info(User, Server, Timestamp, Status).
-
%%%
%%% Private Storage
%%%