From 5e9576ffa3064328dc39b49c7344b309442d7212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20R=C3=A9mond?= Date: Thu, 22 May 2008 10:53:49 +0000 Subject: [PATCH] * src/ejabberd_s2s.erl: Added s2s_send_packet and s2s_receive_packet hooks (EJAB-635). * src/ejabberd_s2s_in.erl: Likewise. SVN Revision: 1342 --- ChangeLog | 4 ++++ src/ejabberd_s2s.erl | 5 +++++ src/ejabberd_s2s_in.erl | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 37a7a7112..2931b60cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-05-22 Mickael Remond + * src/ejabberd_s2s.erl: Added s2s_send_packet and s2s_receive_packet + hooks (EJAB-635). + * src/ejabberd_s2s_in.erl: Likewise. + * src/ejabberd_c2s.erl: user_send_packet hook now called on all packets including presence packets (EJAB-634) diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl index b500388c5..cd878c1b2 100644 --- a/src/ejabberd_s2s.erl +++ b/src/ejabberd_s2s.erl @@ -256,6 +256,11 @@ do_route(From, To, Packet) -> NewAttrs = jlib:replace_from_to_attrs(jlib:jid_to_string(From), jlib:jid_to_string(To), Attrs), + #jid{lserver = MyServer} = From, + ejabberd_hooks:run( + s2s_send_packet, + MyServer, + [From, To, Packet]), send_element(Pid, {xmlelement, Name, NewAttrs, Els}), ok; {aborted, _Reason} -> diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl index cd57e3d1e..9827775d2 100644 --- a/src/ejabberd_s2s_in.erl +++ b/src/ejabberd_s2s_in.erl @@ -412,6 +412,10 @@ stream_established({xmlstreamelement, El}, StateData) -> if ((Name == "iq") or (Name == "message") or (Name == "presence")) -> + ejabberd_hooks:run( + s2s_receive_packet, + LFrom, + [From, To, NewEl]), ejabberd_router:route( From, To, NewEl); true -> @@ -427,6 +431,10 @@ stream_established({xmlstreamelement, El}, StateData) -> if ((Name == "iq") or (Name == "message") or (Name == "presence")) -> + ejabberd_hooks:run( + s2s_receive_packet, + LFrom, + [From, To, NewEl]), ejabberd_router:route( From, To, NewEl); true ->