From: Veera Sundaravel Date: 2008-10-15T15:32:42+09:00 Subject: Re: XMPP client with Ruby Zablon Ochomo wrote: > The code below is working with the xmpp4r form > http://home.gna.org/xmpp4r/ > > require 'XMPP4R' > begin > # Connect to the server and set presence to available for chat. > jid = Jabber::JID.new('myjid@xmppserver/Resource') > client = Jabber::Client.new(jid, false) > client.connect > client.auth('passwd') > client.send(Jabber::Presence.new.set_show(:chat).set_status('Ruby!')) > > # Send an Instant Message. > body = 'Hi XMPP' > to_jid = Jabber::JID.new('tojid@xmppserver') > message = Jabber::Message::new(to_jid, > body).set_type(:normal).set_id('1') > client.send(message) > end > > question: > > how do I receive messages, since I can only send? > > --- > ochomo Hi Zablon, I can send IM to only by setting presence status, But my account have more than 50 or 100 contacts. It will take long time to set the presence and getting status message from each contact. ie, client.send(Jabber::Presence.new.set_show(:chat).set_status('Ruby!')) line of code breaks the functionality of client.send(message). Setting presence took long time, but before to that send message code executed. If I have to wait for getting result of setting presence and then running the send message code only results the required output. Is there any way to send IM without setting Presence. My sever installed with Openfire and IM gateway plugin. Whether I have to install any other plugin or source to automatically log into Transport. Please give your valuable suggestion. Regards, T.Veeraa. -- Posted via http://www.ruby-forum.com/.