Skip to content

Commit

Permalink
Removing xref to mod_last from rebar.config
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Oct 19, 2021
1 parent 3a3261f commit c46fa10
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
mod_bosh_backend, mod_event_pusher_push_backend,
mod_global_distrib_mapping_backend, mod_http_upload_backend,
mod_inbox_backend, mod_keystore_backend,
mod_last_backend, mod_mam_cassandra_arch_params,
mod_mam_cassandra_arch_params,
mod_mam_cassandra_prefs_params, mod_mam_muc_cassandra_arch_params,
mod_muc_db_backend, mod_muc_light_codec_backend,
mod_muc_light_db_backend, mod_offline_backend,
Expand Down
13 changes: 6 additions & 7 deletions src/mod_last.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@
%% ------------------------------------------------------------------
%% Backend callbacks

-export_type([host_type/0, timestamp/0, status/0]).
-export_type([timestamp/0, status/0]).

-type host_type() :: mongooseim:host_type().
-type timestamp() :: non_neg_integer().
-type status() :: binary().

Expand Down Expand Up @@ -178,7 +177,7 @@ process_sm_iq(Acc, From, To, #iq{type = get, sub_el = SubEl} = IQ, _Extra) ->
{Acc, IQ#iq{type = error, sub_el = [SubEl, mongoose_xmpp_errors:forbidden()]}}
end.

-spec make_response(host_type(), jlib:iq(), SubEl :: 'undefined' | [exml:element()],
-spec make_response(mongooseim:host_type(), jlib:iq(), SubEl :: 'undefined' | [exml:element()],
jid:jid(), allow | deny) -> jlib:iq().
make_response(_HostType, IQ, SubEl, _, deny) ->
IQ#iq{type = error, sub_el = [SubEl, mongoose_xmpp_errors:forbidden()]};
Expand Down Expand Up @@ -215,7 +214,7 @@ make_response(HostType, IQ, SubEl, JID, allow) ->
children = []}]}
end.

-spec get_last_info(host_type(), jid:luser(), jid:lserver())
-spec get_last_info(mongooseim:host_type(), jid:luser(), jid:lserver())
-> 'not_found' | {'ok', integer(), binary()}.
get_last_info(HostType, LUser, LServer) ->
case get_last(HostType, LUser, LServer) of
Expand Down Expand Up @@ -255,7 +254,7 @@ store_last_info(Acc, LUser, LServer, Status) ->
store_last_info(HostType, LUser, LServer, TimeStamp, Status),
Acc.

-spec store_last_info(host_type(), jid:luser(), jid:lserver(), timestamp(), status()) -> ok.
-spec store_last_info(mongooseim:host_type(), jid:luser(), jid:lserver(), timestamp(), status()) -> ok.
store_last_info(HostType, LUser, LServer, TimeStamp, Status) ->
case mod_last_backend:set_last_info(HostType, LUser, LServer, TimeStamp, Status) of
{error, Reason} ->
Expand All @@ -268,12 +267,12 @@ store_last_info(HostType, LUser, LServer, TimeStamp, Status) ->
ok
end.

-spec get_last(host_type(), jid:luser(), jid:lserver()) ->
-spec get_last(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
{ok, timestamp(), status()} | {error, term()} | not_found.
get_last(HostType, LUser, LServer) ->
mod_last_backend:get_last(HostType, LUser, LServer).

-spec count_active_users(host_type(), jid:lserver(), timestamp()) -> non_neg_integer().
-spec count_active_users(mongooseim:host_type(), jid:lserver(), timestamp()) -> non_neg_integer().
count_active_users(HostType, LServer, Timestamp) ->
mod_last_backend:count_active_users(HostType, LServer, Timestamp).

Expand Down
26 changes: 13 additions & 13 deletions src/mod_last_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@

-define(MAIN_MODULE, mod_last).

-callback init(mod_last:host_type(), gen_mod:module_opts()) -> ok.
-callback init(mongooseim:host_type(), gen_mod:module_opts()) -> ok.

-callback get_last(mod_last:host_type(), jid:luser(), jid:lserver()) ->
-callback get_last(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
{ok, mod_last:timestamp(), mod_last:status()} | {error, term()} | not_found.

-callback count_active_users(mod_last:host_type(), jid:lserver(), mod_last:timestamp()) ->
-callback count_active_users(mongooseim:host_type(), jid:lserver(), mod_last:timestamp()) ->
non_neg_integer().

-callback set_last_info(
mod_last:host_type(),
mongooseim:host_type(),
jid:luser(),
jid:lserver(),
mod_last:timestamp(),
mod_last:status()) -> ok | {error, term()}.

-callback remove_user(mod_last:host_type(), jid:luser(), jid:lserver()) ->
-callback remove_user(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
ok | {error, term()}.

-callback remove_domain(mod_last:host_type(), jid:lserver()) ->
-callback remove_domain(mongooseim:host_type(), jid:lserver()) ->
ok | {error, term()}.

-spec init(mod_last:host_type(), gen_mod:module_opts()) -> ok.
-spec init(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
init(HostType, Opts) ->
TrackedFuns = [get_last, set_last_info],
mongoose_backend:init_per_host_type(HostType, ?MAIN_MODULE, TrackedFuns, Opts),
Args = [HostType, Opts],
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

-spec get_last(mod_last:host_type(), jid:luser(), jid:lserver()) ->
-spec get_last(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
{ok, mod_last:timestamp(), mod_last:status()} | {error, term()} | not_found.
get_last(HostType, LUser, LServer) ->
Args = [HostType, LUser, LServer],
mongoose_backend:call_tracked(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

-spec count_active_users(mod_last:host_type(), jid:lserver(), mod_last:timestamp()) ->
-spec count_active_users(mongooseim:host_type(), jid:lserver(), mod_last:timestamp()) ->
non_neg_integer().
count_active_users(HostType, LServer, Timestamp) ->
Args = [HostType, LServer, Timestamp],
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

-spec set_last_info(
mod_last:host_type(),
mongooseim:host_type(),
jid:luser(),
jid:lserver(),
mod_last:timestamp(),
Expand All @@ -61,14 +61,14 @@ set_last_info(HostType, LUser, LServer, Timestamp, Status) ->
Args = [HostType, LUser, LServer, Timestamp, Status],
mongoose_backend:call_tracked(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

-spec remove_user(mod_last:host_type(), jid:luser(), jid:lserver()) ->
-spec remove_user(mongooseim:host_type(), jid:luser(), jid:lserver()) ->
ok | {error, term()}.
remove_user(HostType, LUser, LServer) ->
Args = [HostType, LUser, LServer],
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

-spec remove_domain(mod_last:host_type(), jid:lserver()) ->
-spec remove_domain(mongooseim:host_type(), jid:lserver()) ->
ok | {error, term()}.
remove_domain(HostType, LServer) ->
Args = [HostType, LServer],
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).

0 comments on commit c46fa10

Please sign in to comment.