[ejabberd] Exmpp bot jabber client autorization

kael ka-el at laposte.net
Fri May 20 20:26:46 MSD 2011

On 05/20/2011 09:09 AM, Alexander Kuleshov wrote:
> Hello,


> I run echo client
> (https://github.com/processone/exmpp/blob/master/examples/echo_client.erl)
> It works. But when i add it to roster it's offline. Why?

In echo_client:loop/1, the second clause handles only <message/>, and 
the third one handles other packets which are just print in the console.

> How can i make online status for it?

You need to add, in echo_client:loop/1, a clause to handle presence 
packets :

Record = #received_packet{packet_type = presence},

And to send a presence back to the contact.

I've attached a modified version of echo_client.erl which handles 
presence and presence subscription, and maintains a list of online contacts.

See this tutorial 

And the "sub2text" bot which is a great example of an exmpp bot using 
gen_server <https://github.com/astro/sub2text> and specially 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: echo_client.erl
Type: text/x-erlang
Size: 6557 bytes
Desc: not available
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20110520/58e7ea21/attachment.bin>

More information about the ejabberd mailing list