[ejabberd] Parsing Packet Contents

Jorge Guntanis jorge at guntanis.com
Tue Mar 31 19:26:07 MSD 2009


Thanks Badlop an Iakovos!
Those where exactly the pointers I was looking for.

Jorge


On Tue, Mar 31, 2009 at 5:26 AM, James Mandelis <
ejabberd_maillist at 008.clara.co.uk> wrote:

>  Hi Jorge,
>
>
>
> 1)      You will find the functions for parsing the Packet in the xml.erl
> module.
>
> 2)      Here is a suggestion:
> Cmd = "/sbin/myCommand "++ xml:get_subtag_cdata(Packet ,"body"),
>
>
>
> I hope this helps.
>
>
>
> Regards,
>
> 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?
>
> Thanks,
> Jorge
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090331/6b7ec062/attachment-0001.htm>


More information about the ejabberd mailing list