[ejabberd] Altering message body in a module

Daniel Dormont dan at greywallsoftware.com
Sat Mar 31 09:02:21 MSK 2012


You'll have to construct the appropriate tuple representing your new
message stanza yourself. If it's just the content of the body you want to
set, and you don't need any additional elements, then a simple:

{xmlelement, "message", OrigAttrs, [{xmlelement, "body", [], [{xmlcdata,
NewBodyText}]}]}

ought to work. This is assuming you kept the attributes for the original
message in a variable.

dan

On Fri, Mar 30, 2012 at 7:54 PM, Hisham Mardam Bey <
hisham.mardambey at gmail.com> wrote:

> Hi folks,
>
> I'm working on a module for ejabberd 2.1.x that needs to alter the
> contents of the body in a message stanza. I'm to the point where I
> have my altered body as a string and I want to put it back into the
> cdata entry in the message. exmpp offers convenience functions to do
> these kinds of operations but I am not sure how to do it on my own
> being new to Erlang. Any recommendations?
>
> Thanks,
>
> hmb.
>
> --
> Hisham Mardam-Bey
> http://hisham.cc/
> _______________________________________________
> 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/20120331/d2aef6b7/attachment.html>


More information about the ejabberd mailing list