From: brabuhr@... Date: 2008-01-26T00:45:34+09:00 Subject: Re: XMPP client with Ruby On Jan 25, 2008 4:47 AM, Zablon Ochomo wrote: > Stephane Wirtel wrote: > > Zablon Ochomo a �crit : > >> Does anyone out there know how to implement an xmpp client to a server > >> like ejabberd using ruby? > > > > There are two xmpp library in the gem repository > > thanks > > I had downloaded the xmpp4r gem and installed. Here's a test script I played with awhile ago to pipe the output of a program to me over jabber using xmpp4r-simple: require 'rubygems' require 'highline' require 'xmpp4r-simple' hl = HighLine.new Username = hl.ask("Username: ") Password = hl.ask("Password: ") { |q| q.echo = "x" } Notifier = hl.ask("Notifier: ") Resource = "notificabot" Server = "XXX" @jabber = { :username => "#{Username}/#{Resource}@#{Server}", :password => "#{Password}" } @notify = "#{Username}@jabber.ctc.com" begin Signal.trap(:INT) { raise } Signal.trap(:TERM) { raise } IO.popen(Notifier, "r") do |notifier| im = Jabber::Simple.new(@jabber[:username], @jabber[:password]) begin im.status(:dnd, "notificabot") notifier.each_line do |line| im.deliver(@notify, line.chomp) puts line end rescue puts $!.message ensure im.disconnect end end rescue puts $!.message end