usr bin env ruby coding utf-8 require xmpp4r client include Jabber Jab

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
# coding: utf-8
require 'xmpp4r/client'
include Jabber
Jabber::debug = true
jid = 'xxxx@jabber.org'
password = '****'
client = Client::new(jid)
client.connect
client.auth(password)
client.send(Presence::new)
client.add_message_callback do |message|
puts "Received message from #{message.from}: message.body"
end
sleep