Skip to content

Commit

Permalink
Improve type specs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Jul 27, 2021
1 parent 5554a99 commit 90d6156
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/auth/ejabberd_auth_external.erl
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ get_last_access(HostType, LUser, LServer) ->


-spec get_last_info(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
{ok, Timestamp :: integer(), Status :: binary()} | not_found | mod_last_required.
{ok, mod_last:timestamp(), mod_last:status()} | not_found | mod_last_required.
get_last_info(HostType, LUser, LServer) ->
case gen_mod:is_loaded(HostType, mod_last) of
true -> mod_last:get_last_info(HostType, LUser, LServer);
Expand Down
6 changes: 3 additions & 3 deletions src/mod_last_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ init(_HostType, _Opts) ->
ok.

-spec get_last(host_type(), jid:luser(), jid:lserver()) ->
{ok, non_neg_integer(), binary()} | {error, term()} | not_found.
{ok, mod_last:timestamp(), mod_last:status()} | {error, term()} | not_found.
get_last(_HostType, LUser, LServer) ->
case catch mnesia:dirty_read(last_activity, {LUser, LServer}) of
{'EXIT', Reason} -> {error, Reason};
Expand All @@ -45,15 +45,15 @@ get_last(_HostType, LUser, LServer) ->
{ok, TimeStamp, Status}
end.

-spec count_active_users(host_type(), jid:lserver(), non_neg_integer()) -> non_neg_integer().
-spec count_active_users(host_type(), jid:lserver(), mod_last:timestamp()) -> non_neg_integer().
count_active_users(_HostType, LServer, TimeStamp) ->
MS = [{{last_activity, {'_', LServer}, '$1', '_'},
[{'>', '$1', TimeStamp}],
[true]}],
ets:select_count(last_activity, MS).

-spec set_last_info(host_type(), jid:luser(), jid:lserver(),
non_neg_integer(), binary()) -> ok | {error, term()}.
mod_last:timestamp(), mod_last:status()) -> ok | {error, term()}.
set_last_info(_HostType, LUser, LServer, TimeStamp, Status) ->
US = {LUser, LServer},
F = fun() ->
Expand Down
2 changes: 1 addition & 1 deletion src/mod_last_riak.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ init(_VHost, _Opts) ->
ok.

-spec get_last(host_type(), jid:luser(), jid:lserver()) ->
{ok, mod_last:timestamp(), mod_last:status()} | not_found.
{ok, mod_last:timestamp(), mod_last:status()} | {error, term()} | not_found.
get_last(HostType, LUser, LServer) ->
case mongoose_riak:get(bucket_type(HostType, LServer), LUser) of
{ok, Obj} ->
Expand Down

0 comments on commit 90d6156

Please sign in to comment.