<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    An Ejabberd module is a part of the server-side XMPP. EXMPP is the
    client-side XMPP. What you are trying is to embed client-side into
    server-side which is meaningless because you try to connect to the
    server from within. For handling the packets, use the server
    handlers. For sending/receiving packets to/for an user, use
    client-side XMPP.<br>
    <br>
    Now, depending what you need, there are some options from which I
    can guess few which may help you:<br>
    1. Server-application communication: see external services, for
    example.<br>
    2. User packet redirection: see Ejabberd handlers.<br>
    3. Server-server communication: see s2s module, for example.<br>
    But, since I have no knowledge about what you need, there may be
    other options which fit better your project.<br>
    <br>
    Cheers,<br>
    CGS<br>
    <br>
    <br>
    <br>
    On 11/02/2011 11:36 AM, Alexander Kuleshov wrote:
    <blockquote
cite="mid:CANCZXo6sfhY0WG9reCWA656-DN+772jsvpwK1qmbKmDiSp0kyQ@mail.gmail.com"
      type="cite"><br>
      <br>
      <div class="gmail_quote">2011/11/2 Alexander Kuleshov <span
          dir="ltr"><<a moz-do-not-send="true"
            href="mailto:kuleshovmail@gmail.com">kuleshovmail@gmail.com</a>></span><br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div>Hello,<br>
          </div>
          <div><br>
          </div>
          <div>I try to run jabber bot in ejabberd, written with exmpp.</div>
          <div><br>
          </div>
          <div>My bot is usual gen_server remade from example: <a
              moz-do-not-send="true"
href="https://github.com/onlyshk/exmpp/blob/master/examples/echo_client.erl"
              target="_blank">https://github.com/onlyshk/exmpp/blob/master/examples/echo_client.erl</a></div>
          <div><br>
          </div>
          <div>If i run it from terminal it's ok i see online bot in
            admin page. But if i try to run it with my ejabberd module,
            inside in it, i get crash report:</div>
          <div><br>
          </div>
          <div>=ERROR REPORT==== 2-Nov-2011::16:30:25 ===<br>
            ** State machine <0.416.0> terminating <br>
            ** Last event in was tcp_closed (for all states)<br>
            ** When State == stream_opened<br>
            ** Data == {state,digest,<br>
{{jid,<<"mybot@localhost/exmpp#1320251360207273">>,</div>
          <div><<"mybot">>,<<"localhost">>,<br>
            <<"exmpp#1320251360207273">>},<br>
            "password"},<br>
            {0,0},<br>
            false,false,false,<br>
            [{compression,enabled},{starttls,enabled}],<br>
            "localhost","localhost",<0.415.0>,exmpp_socket,<br>
            {gen_tcp,#Port<0.5947>},<br>
            {xml_stream,<br>
            {gen_fsm,<0.416.0>},<br>
            {xml_parser,<br>
            [{max_size,infinity},<br>
            {root_depth,1},<br>
            {names_as_atom,true},<br>
            {emit_endtag,true},<br>
            {check_nss,xmpp},<br>
            {check_elems,xmpp},<br>
            {check_attrs,xmpp}],<br>
            #Port<0.5840>},<br>
            new,false,undefined},<br>
            "3244568556",undefined,<0.428.0>,undefined,undefined}<br>
            ** Reason for termination = <br>
            ** tcp_closed<br>
            <br>
            =CRASH REPORT==== 2-Nov-2011::16:30:25 ===<br>
            crasher:<br>
            initial call: exmpp_session:init/1<br>
            pid: <0.416.0><br>
            registered_name: []<br>
            exception exit: tcp_closed<br>
            in function gen_fsm:terminate/7<br>
            ancestors: [mybot,ejabberd_sup,<0.40.0>]<br>
            messages: []<br>
            links: []<br>
            dictionary: [{random_seed,{1320,8904,23723}}]<br>
            trap_exit: false<br>
            status: running<br>
            heap_size: 1597<br>
            stack_size: 24<br>
            reductions: 1162<br>
            neighbours:<br>
             </div>
          <div>How can i run it with ejabberd module?</div>
          <div><br>
          </div>
          <div>Thank you.</div>
        </blockquote>
      </div>
      <div><br>
      </div>
      <div>And also i got:<br>
      </div>
      <div><br>
      </div>
      <div>=CRASH REPORT==== 2-Nov-2011::16:29:25 ===<br>
        crasher:<br>
        initial call: xmpp_talker:init/1<br>
        pid: <0.415.0><br>
        registered_name: []<br>
        exception exit: {timeout,{gen_fsm,sync_send_event,<br>
        [<0.416.0>,<br>
        {connect_socket,"localhost",5222,[]},<br>
        5000]}}<br>
        in function gen_server:init_it/6<br>
        ancestors: [ejabberd_sup,<0.40.0>]<br>
        messages: []<br>
        links: [<0.245.0>]<br>
        dictionary: []<br>
        trap_exit: false<br>
        status: running<br>
        heap_size: 610<br>
        stack_size: 24<br>
        reductions: 320<br>
        neighbours:<br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
ejabberd mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ejabberd@jabber.ru">ejabberd@jabber.ru</a>
<a class="moz-txt-link-freetext" href="http://lists.jabber.ru/mailman/listinfo/ejabberd">http://lists.jabber.ru/mailman/listinfo/ejabberd</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>