ruby dbus and avahi zeroconf

i was playing with ruby-dbus this afternoon. the 'rbus' gem wasn't working for me.

require 'dbus' bus = DBus::SystemBus.instance p=bus.introspect("org.freedesktop.Avahi","/") server = p["org.freedesktop.Avahi.Server"]

sb = server.ServiceBrowserNew(-1,-1,"_presence._tcp","",0) puts sb.inspect

register for signals

mr = mr.type = "signal" mr.interface = "org.freedesktop.Avahi.ServiceBrowser" mr.path = sb.first bus.add_match(mr) do |msg, first_param|

puts msg.params.inspect

puts msg.member + " " +msg.params[2].to_s end

Main loop

main = main << bus /typo:code

With pidgin running, a zeroconf presence is established and the ruby script picks up on that.

ruby-dbus-0.2.1$ ruby -I lib /home/donp/src/ruby/avahi.ruby.dbus.rb
ItemNew Don park@sparky

the idea is to add opengl bits to make a group of spheres that represent people/laptops in the cafe. (inspired by gl_tail)