From: Jeremy Bopp Date: 2011-01-03T03:56:47+09:00 Subject: Re: Connecting with GTalk with Jabber/XMPP On 01/02/2011 12:43 PM, Jakub Groncki wrote: > Hello! I've got some problems with connecting to GTalk via xmpp4r lib. > I'm trying to run this code: > > require 'rubygems' > require 'xmpp4r-simple' > include Jabber > > jabber = Simple.new('user@gmail.com', 'password') > > But ruby returns following error: > > > client.rb:3:in `require': > C:/Ruby191/lib/ruby/gems/1.9.1/gems/xmpp4r-simple-0.8. > 8/lib/xmpp4r-simple.rb:441: syntax error, unexpected ':', expecting > keyword_then > or ',' or ';' or '\n' (SyntaxError) > when nil: new_presence.show || :online > ^ > C:/Ruby191/lib/ruby/gems/1.9.1/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb:442 > : syntax error, unexpected keyword_when, expecting keyword_end > when :unavailable: :unavailable > ^ > C:/Ruby191/lib/ruby/gems/1.9.1/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb:443 > : syntax error, unexpected keyword_else, expecting keyword_end > C:/Ruby191/lib/ruby/gems/1.9.1/gems/xmpp4r-simple-0.8.8/lib/xmpp4r-simple.rb:490 > : syntax error, unexpected keyword_end, expecting $end > from client.rb:3:in `
' > > Really sorry for my bad English :( I don't know what's the matter. I was > looking for similar problems here, on forum and I 'googled' it but I > didn't receive any good results. Hope I'm understandable. That gem is incompatible with Ruby 1.9 syntax, and you appear to be attempting to use it under Ruby 1.9. The problem is that the when keyword of the case statement no longer allows the use of a colon to end the match expression. One must either use the then keyword or a newline instead. You should either contact the gem author and request an update, fork the project and update it yourself, or use the gem under Ruby 1.8.7. Good luck! :-) -Jeremy