Connecting with GTalk with Jabber/XMPP

Discussion in 'Ruby' started by Jakub Groncki, Jan 2, 2011.

  1. 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('', '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 || :eek:nline
    ^
    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 `<main>'

    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.
     
    Jakub Groncki, Jan 2, 2011
    #1
    1. Advertisements

  2. Jakub Groncki

    Jeremy Bopp Guest

    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
     
    Jeremy Bopp, Jan 2, 2011
    #2
    1. Advertisements

  3. So I've got job for the weekend ;-) I'll try. Just one question: is
    there any other gem which supports the Jabber protocol?
     
    Jakub Groncki, Jan 2, 2011
    #3
  4. Jakub Groncki

    sammcj Guest

    Hey,

    Did you ever get anywhere with this for ruby 1.9 / 2.x ?
     
    sammcj, May 3, 2014
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.