quarta-feira, 16 de março de 2011

Displaying pidgin received messages in Asus G50VT

I'm using a ASUS G50VT-X5 with Ubuntu 10.10,
recently I reinstalled the last version of "asusg50oled" as seen on
http://asusg50oled.sourceforge.net/

It installed perfectly fine, no errors, just followed the "Quick system preparation guide" and worked like a charm!

In my last installation I hacked the preferences file and thought about receiving chat messages through the oled display. I take a look at Telepathy Library because the default chat program in Ubuntu 10.10 is Empathy and it's based on Telepathy... Well my first thought is that using DBus with Pidgin was easier, although Telepathy may use DBus I didn't even make a deeper look in it because I think Pidgin had more examples of "How to write a plugin".
My preferred programming language is Ruby and I use 1.9.2-head and ruby-dbus gem to make this work.

links:
http://technomancy.us/83 (gsub to take out formatting tags)
https://lists.luon.net/pipermail/ruby-dbus-devel/2007-May/000015.html (DBus pidgin example)

doc:
http://developer.pidgin.im/wiki/DbusHowto
http://rubygems.org/gems/ruby-dbus

screenshot:
img

code:

require 'dbus'

bus = DBus::SessionBus.instance
@service = bus.service("im.pidgin.purple.PurpleService")
@purple = @service.object("/im/pidgin/purple/PurpleObject")

@purple.introspect
@purple.default_iface ="im.pidgin.purple.PurpleInterface"
@purple.on_signal("ReceivedImMsg") do |account, old, new|
new.gsub!(/\<[^\>]*\>/, '') # jabber messages have unnecessary XML
system("/opt/asusg50oled/utils/notify.sh","#{Pidgin:} #{old} #{new}")
#p [old, new]
end

m = DBus::Main.new
m << bus
m.run




Next thing to do is create a Pidgin plugin out of this... I think that'll be the hardest, and I need to know if you can write those in Ruby.

cya!

Nenhum comentário:

Postar um comentário