Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 23 lines (19 sloc) 0.848 kb
4af52031 » unknown
2012-03-12 Add python scripts and touch sensor library
1 #!/usr/bin/env python
2
d1123d4c » Andrew Schamp
2012-03-12 Whoops, forgot socket importt push
3 import socket
4af52031 » unknown
2012-03-12 Add python scripts and touch sensor library
4 import dbus, gobject
5 from dbus.mainloop.glib import DBusGMainLoop
6
7 def my_func(account, sender, message, conversation, flags):
8 if bus.pidginbus.PurpleConversationHasFocus(conversation) == 0:
9 # send a message to the mpd_console
10 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
11 sock.connect(('localhost', 12345))
12 sock.send("foo")
13
14 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
15 bus = dbus.SessionBus()
16 obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
17 bus.pidginbus = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
18 bus.add_signal_receiver(my_func,
19 dbus_interface="im.pidgin.purple.PurpleInterface",
20 signal_name="ReceivedImMsg")
21
22 loop = gobject.MainLoop()
23 loop.run()
24
Something went wrong with that request. Please try again.