25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-09 15:06:54 +02:00

* src/ejabberd_s2s.erl: Added s2s_send_packet and s2s_receive_packet hooks (EJAB-635).

* src/ejabberd_s2s_in.erl: Likewise.

SVN Revision: 1342
This commit is contained in:
Mickaël Rémond 2008-05-22 10:53:49 +00:00
parent cf42ea0bcb
commit 5e9576ffa3
3 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2008-05-22 Mickael Remond <mremond@process-one.net>
* 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)

View File

@ -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} ->

View File

@ -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 ->