[ejabberd] Sen message from ejabberd plugin

Badlop badlop at gmail.com
Thu Nov 3 18:10:43 MSK 2011


2011/11/3 Alexander Kuleshov <kuleshovmail at gmail.com>:
> I have simple ejabebrd plugin and i need to esn message from it.
> My code:
> send_message(TypeStr, BodyStr) ->
>     LUser = "test1",
>     LServer = "localhost",
>     From1 = jlib:make_jid(LUser, LServer, "fb"),
>
>     TUser = "test2",
>     TServer = "localhost",
>     To1 = jlib:make_jid(TUser, TServer, "fb"),
>
>     FromAddress = jlib:jid_to_string(From1),
>     ToAddress = jlib:jid_to_string(To1),
>
>     XmlBody = {xmlelement, "message", [{"type", TypeStr}, {"from",
> FromAddress}, {"to", ToAddress}], [{xmlelement, "body", [], [{xmlcdata,
> BodyStr}]}]},
>    ejabberd_router:route(From, To, XmlBody).


First of all, From and To are undefined in the last line of that function.
Change the last line to:
  ejabberd_router:route(From1, To1, XmlBody).


---
Badlop
ProcessOne


More information about the ejabberd mailing list