This is Ruburple, a Ruby extension to libpurple (the library formerly known as libgaim).

It consists of a chunky C extension and a small piece of Ruby to wrap some of the C calls in a nicer package.

Dependencies:

libpurple 2.0.0

Distributed with Pidgin 2.0.0 (the application formerly known as Gaim): www.pidgin.im/

glib-2.0

Could possibly work with other versions, but right now my extconf.rb only looks for 2.0 (patches welcome): www.gtk.org/

pkg-config

Just for extconf.rb to be able to find glib-2.0. Should be installed when you install glib, AFAIK.

Hints:

I hade some trouble getting a precompiled set of libpurple libs with headers, so I downloaded the source.

Then, to build, I did:

./configure --disable-gtkui --disable-consoleui --disable-screensaver --disable-startup-notification --disable-sm --disable-gtkspell --disable-gevolution --disable-cap --disable-gstreamer --disable-tcl --disable-tk --disable-doxygen --disable-perl --with-gnutls-includes=/opt/local/include/ --with-gnutls-libs=/opt/local/lib/

This is mainly because I dont need any of the disabled features to get ruburple running, and the configure script had big trouble finding the gnutls headers and libs on its own.

Usage example:

This example uses almost all methods defined in the ruburple gem. For a few other methods look at the test/ruburple_test.rb.

require 'ruburple'
Ruburple::init
Ruburple::subscribe(:received_im_msg, (Proc.new do |a,b,c,d,e| puts "rcv im: #{a}, #{b}, #{c}, #{d}, #{e}" end))
Ruburple::subscribe(:signed_on, (Proc.new do |a| puts "signed on: #{a}" end))
p = Ruburple::get_protocol("MSN")
puts "gonna connect to #{p.id}, #{p.name}, #{p.version}, #{p.summary}, #{p.description}, #{p.author}, #{p.homepage}"
a = p.("[email protected]", "some_msn_password")
a.connect
a.connection.send_im("some_other@msn_account", "some message")
a.connection.close

It doesnt work!

Do

Ruburple::debug = true

and mail me a description of the problem, and Ill see what I can do. Warning: ruburple will be extremely chatty (pun intended) when you do this.