25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

* src/ejabberd_router.erl: Added route_packet hook

SVN Revision: 380
This commit is contained in:
Alexey Shchepin 2005-07-27 00:54:53 +00:00
parent 02d3151ee7
commit e9e1893b01
2 changed files with 45 additions and 34 deletions

View File

@ -1,3 +1,7 @@
2005-07-27 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_router.erl: Added route_packet hook
2005-07-26 Alexey Shchepin <alexey@sevcom.net> 2005-07-26 Alexey Shchepin <alexey@sevcom.net>
* src/jd2ejd.erl: Updated to work with ODBC * src/jd2ejd.erl: Updated to work with ODBC

View File

@ -80,8 +80,13 @@ loop() ->
loop() loop()
end. end.
do_route(From, To, Packet) -> do_route(OrigFrom, OrigTo, OrigPacket) ->
?DEBUG("route~n\tfrom ~p~n\tto ~p~n\tpacket ~p~n", [From, To, Packet]), ?DEBUG("route~n\tfrom ~p~n\tto ~p~n\tpacket ~p~n",
[OrigFrom, OrigTo, OrigPacket]),
LOrigDstDomain = OrigTo#jid.lserver,
case ejabberd_hooks:run_fold(
route_packet, LOrigDstDomain, {OrigFrom, OrigTo, OrigPacket}, []) of
{From, To, Packet} ->
LDstDomain = To#jid.lserver, LDstDomain = To#jid.lserver,
case mnesia:dirty_read(route, LDstDomain) of case mnesia:dirty_read(route, LDstDomain) of
[] -> [] ->
@ -116,9 +121,11 @@ do_route(From, To, Packet) ->
Pid ! {route, From, To, Packet} Pid ! {route, From, To, Packet}
end end
end end
end;
drop ->
ok
end. end.
%route(From, To, Packet) -> %route(From, To, Packet) ->
% ejabberd_router ! {route, From, To, Packet}. % ejabberd_router ! {route, From, To, Packet}.