[ejabberd] Sen message from ejabberd plugin

CGS cgsmcmlxxv at gmail.com
Thu Nov 3 16:34:24 MSK 2011


Oh, sorry, ignore my previous message as I didn't understand you 
question. I suppose the "{badrecord,jid}" is referring to "to" field 
where you inserted also the user resources "/fb". Field "to" should 
contain only "user at server" as far as I know (in your case, 
"test2 at localhost").

CGS



On 11/03/2011 08:30 AM, Alexander Kuleshov wrote:
> Hello,
>
> 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).
>
> But i get error:
>
> =ERROR REPORT==== 2011-11-03 13:27:12 ===
> E(<0.494.0>:ejabberd_router:70) : {{badrecord,jid},
>                                                   
> [{ejabberd_router,do_route,3},
>                                                   
> {ejabberd_router,route,3},
>                                                   
> {mod_poker,on_register,3},
>                                                   {ejabberd_hooks,run1,3},
>                                                   
> {ejabberd_c2s,wait_for_auth,2},
>                                                  {p1_fsm,handle_msg,10},
>                                                 
>  {proc_lib,init_p_do_apply,3}]}
> when processing: {"test1 at localhost","test2 at localhost",
> {xmlelement,"message",
> [{"type","chat"},
>   {"from","test1 at localhost/fb"},
>   {"to","test2 at localhost/fb"}],
>   [{xmlelement,"body",[],[{xmlcdata,"test test"}]}]}}
>
> How can i fix it? How can i send message from ejabberd plugin?
>
> Thank you.
>
>
> _______________________________________________
> 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/20111103/c3db9410/attachment.html>


More information about the ejabberd mailing list