[ejabberd] Parsing Packet Contents

James Mandelis ejabberd_maillist at 008.clara.co.uk
Tue Mar 31 16:26:32 MSD 2009

Hi Jorge,


1)      You will find the functions for parsing the Packet in the xml.erl

2)      Here is a suggestion:
Cmd = "/sbin/myCommand "++ xml:get_subtag_cdata(Packet ,"body"),


I hope this helps.



Iakovos Mandelis


From: ejabberd-bounces at jabber.ru [mailto:ejabberd-bounces at jabber.ru] On
Behalf Of guntanis at gmail.com
Sent: Tuesday, March 31, 2009 7:10 AM
To: ejabberd at jabber.ru
Subject: [ejabberd] Parsing Packet Contents


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/3b1b5ab7/attachment.htm>

More information about the ejabberd mailing list