* Create TODO.org and summarize further development plans
[pidgin-purple-perl-plugins.git] / playing-dbus.py
blob7743fdd4701b8348b47a06ff516af30e4c7353ce
1 #!/usr/bin/env python
3 #2008-09-17.131915+0200CEST.txt:(13:27:34) wjt: mcepl: if the send_raw prpl method and the #xmpp-receiving-xml (possibly differently named) signal are exposed on the bus, yes
4 #[matej@hubmaier #pidgin.chat]$
6 # There is JabberReceivingXmlnode
7 # (22:58:25) nosnilmot: mcepl: it's actually "jabber-receiving-xmlnode" and doesn't
8 # appear to be documented anywhere I can find, it appears to be emitted with two
9 # parameters: (PurpleConnection *gc, xmlnode **node) ("jabber-sending-xmlnode" is the
10 # sending equivalent, emitted in the same way)
12 def my_func(account, sender, message, conversation, flags):
13 print sender, "said:", message
15 import dbus, gobject
16 from dbus.mainloop.glib import DBusGMainLoop
17 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
18 bus = dbus.SessionBus()
20 bus.add_signal_receiver(my_func,
21 dbus_interface="im.pidgin.purple.PurpleInterface",
22 signal_name="ReceivedImMsg")
23 print "OK, %s" % dir(bus)
24 loop = gobject.MainLoop()
25 loop.run()