Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 25 lines (19 sloc) 0.848 kb
4af5203 Add python scripts and touch sensor library
unknown authored
1 #!/usr/bin/env python
2
d1123d4 Whoops, forgot socket importt push
Andrew Schamp authored
3 import socket
4af5203 Add python scripts and touch sensor library
unknown authored
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.