25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-03 14:45:16 +02:00
xmpp.chapril.org-ejabberd/src/ejabberd_local.erl
Alexey Shchepin 206b5cd2fb *** empty log message ***
SVN Revision: 10
2002-11-30 18:46:16 +00:00

46 lines
961 B
Erlang

%%%----------------------------------------------------------------------
%%% File : ejabberd_local.erl
%%% Author : Alexey Shchepin <alexey@sevcom.net>
%%% Purpose :
%%% Created : 30 Nov 2002 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%%----------------------------------------------------------------------
-module(ejabberd_local).
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
%%-export([Function/Arity, ...]).
-export([start/0,init/0]).
-include("ejabberd.hrl").
start() ->
spawn(ejabberd_local, init, []).
init() ->
ejabberd_router:register_local_route("localhost"),
loop().
loop() ->
receive
{route, From, To, Packet} ->
do_route(From, To, Packet),
loop()
end.
do_route(From, To, Packet) ->
?DEBUG("local route~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
[From, To, Packet, 8]),
case To of
{"", _, _} ->
ok;
_ ->
ejabberd_sm ! {route, From, To, Packet}
end,
ok.