[ejabberd] Running an echo bot on the 'main' xmpp domain

Adam Hayward adam at happy.cat
Tue Jan 26 00:11:34 MSK 2010


Hello there,

Sorry, I can't find a way to phrase this question without sounding totally
clueless :-S

I would like to know how it is possible to run a module on the "main" domain
of my ejabberd server.  For example, given a xmpp server "example.com", how
might I install Andrew Conbere's
mod_echo_bot<http://anders.conbere.org/blog/2008/08/06/building_ejabberd_modules_-_part_4_-_xmpp_bots/>directly
on "
example.com" and not on "echo.example.com"? I'm assuming that the trick is
to 'hijack' all incoming messages in the init phase of the module:

init([Host, Opts]) ->
    ?DEBUG("ECHO_BOT: Starting echo_bot", []),
    % add a new virtual host / subdomain "echo".example.com


    MyHost = gen_mod:get_opt_host(Host, Opts, "echo. at HOST@"),

    ejabberd_router:register_route(MyHost, {apply, ?MODULE, route}),
    {ok, Host}.

Although it does not seem to be as simple as just changing the 4th line to:

    MyHost = gen_mod:get_opt_host(Host, Opts, "@HOST@"),

Thanks and regards,

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100125/b01ed93f/attachment.html>


More information about the ejabberd mailing list