Add s2s_out_bounce_packet hook

This commit is contained in:
Alexey Shchepin 2023-01-27 03:53:28 +03:00
parent f650b1e83c
commit f6b5a52104
1 changed files with 11 additions and 4 deletions

View File

@ -360,10 +360,17 @@ bounce_message_queue(FromTo, State) ->
-spec bounce_packet(xmpp_element(), state()) -> state().
bounce_packet(Pkt, State) when ?is_stanza(Pkt) ->
Lang = xmpp:get_lang(Pkt),
Err = mk_bounce_error(Lang, State),
ejabberd_router:route_error(Pkt, Err),
State;
#{server_host := Host} = State,
case ejabberd_hooks:run_fold(
s2s_out_bounce_packet, Host, State, [Pkt]) of
ignore ->
State;
State2 ->
Lang = xmpp:get_lang(Pkt),
Err = mk_bounce_error(Lang, State2),
ejabberd_router:route_error(Pkt, Err),
State2
end;
bounce_packet(_, State) ->
State.