Title / Description
Code require 'rubygems' require 'xmpp4r' # Connect to the server and set presence to available for chat. puts 'Enter your username with full domain' uname = gets puts 'Enter your password' passwd = gets uname = uname.chomp passwd = passwd.chomp jid = Jabber::JID.new(uname) client = Jabber::Client.new(jid) client.connect client.auth(passwd) #client.send(Jabber::Presence.new.set_show(:chat).set_status('Rails!')) puts 'Enter your friend id to whom you want to send the message' toname = gets toname = toname.chomp # Send an Instant Message. puts 'Enter the message you want to send' body = gets to_jid = Jabber::JID.new(toname) message = Jabber::Message::new(to_jid, body).set_type(:chat).set_id('1') client.send(message)
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code