[ejabberd] Parsing Packet Contents

guntanis at gmail.com guntanis at gmail.com
Tue Mar 31 09:09:44 MSD 2009

This is probably a really basic question and is mostly related to erlang.
I'm making a module based on the mod_echo that takes the message and send  
it to an external program and returns the output command.
I have something like this:
handle_info({route, From, To, Packet}, State) ->
Cmd = "/sbin/myCommand ",
Port = os:cmd(Cmd),
ejabberd_router:route(To, From, Port),
{noreply, State};
handle_info(_Info, State) ->
{noreply, State}.

But I'm not sure on how to:
1. get the body of the message from Packet.
2. concatenate Cmd with the body of the message, so it's passed as the  
parameter of the external command.

Can someone help me with some pointers on this one?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090331/907e30d0/attachment.htm>

More information about the ejabberd mailing list