25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00
xmpp.chapril.org-ejabberd/src/mod_echo.erl
Alexey Shchepin f3916bddd2 * src/cyrsasl*.erl: SASL support (currently support only PLAIN
mechanism)
* src/ejabberd_c2s.erl: Likewise

(all): Support for new-style error elements (except old errors
"Not Acceptable", "Not Found", "Invalid Namespace" and "Server
Connect Failed", so ejabberd may work unstable)

SVN Revision: 86
2003-03-09 20:46:47 +00:00

46 lines
1.0 KiB
Erlang

%%%----------------------------------------------------------------------
%%% File : mod_echo.erl
%%% Author : Alexey Shchepin <alexey@sevcom.net>
%%% Purpose :
%%% Created : 15 Jan 2003 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%%----------------------------------------------------------------------
-module(mod_echo).
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
-behaviour(gen_mod).
-export([start/1, init/1, stop/0]).
-include("ejabberd.hrl").
-include("jlib.hrl").
start(Opts) ->
%Host = gen_mod:get_opt(host, Opts),
Host = gen_mod:get_opt(host, Opts, "echo." ++ ?MYNAME),
register(ejabberd_mod_echo, spawn(?MODULE, init, [Host])).
init(Host) ->
ejabberd_router:register_local_route(Host),
loop(Host).
loop(Host) ->
receive
{route, From, To, Packet} ->
ejabberd_router:route(To, From, Packet),
loop(Host);
stop ->
ejabberd_router:unregister_local_route(Host),
ok;
_ ->
loop(Host)
end.
stop() ->
ejabberd_mod_echo ! stop,
ok.