Skip to content

Commit

Permalink
Remove ejabberd_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Dec 15, 2022
1 parent 8a48d0a commit d0ead02
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/c2s/mongoose_c2s_hooks.erl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
Params :: params(),
Result :: result().
user_send_packet(HostType, Acc, Params) ->
{From, To, El} = mongoose_acc:packet(Acc),
Args = [From, To, El],
ParamsWithLegacyArgs = ejabberd_hooks:add_args(Params, Args),
gen_hook:run_fold(user_send_packet, HostType, Acc, ParamsWithLegacyArgs).
gen_hook:run_fold(user_send_packet, HostType, Acc, Params).

%% @doc Triggered when a user receives a packet through any routing mechanism.
%% Examples of handlers can be metrics or carbons.
Expand All @@ -53,12 +50,8 @@ user_send_packet(HostType, Acc, Params) ->
Acc :: mongoose_acc:t(),
Params :: params(),
Result :: result().
user_receive_packet(HostType, Acc, #{c2s_data := C2SData} = Params) ->
{From, To, El} = mongoose_acc:packet(Acc),
Jid = mongoose_c2s:get_jid(C2SData),
Args = [Jid, From, To, El],
ParamsWithLegacyArgs = ejabberd_hooks:add_args(Params, Args),
gen_hook:run_fold(user_receive_packet, HostType, Acc, ParamsWithLegacyArgs).
user_receive_packet(HostType, Acc, Params) ->
gen_hook:run_fold(user_receive_packet, HostType, Acc, Params).

%% @doc Triggered when the user sends a stanza of type `message'
-spec user_send_message(HostType, Acc, Params) -> Result when
Expand Down

0 comments on commit d0ead02

Please sign in to comment.