summaryrefslogtreecommitdiffstats
path: root/cholerab/knut/clients/pidgin_speak/speak.py
diff options
context:
space:
mode:
authorChinaman <root@chinaman>2011-09-06 19:47:58 +0200
committerChinaman <root@chinaman>2011-09-06 19:47:58 +0200
commit108f3616e3f4958752d881192ef29e5fc4c2b045 (patch)
tree3c67478c852265219b72e6e1b05467d7065b7ba8 /cholerab/knut/clients/pidgin_speak/speak.py
parentb2d65500160bcdf7abb2bf985f7da582b810e25c (diff)
parentc3bc5a6d16868c121aca780f3109155797b51d76 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'cholerab/knut/clients/pidgin_speak/speak.py')
-rwxr-xr-xcholerab/knut/clients/pidgin_speak/speak.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/cholerab/knut/clients/pidgin_speak/speak.py b/cholerab/knut/clients/pidgin_speak/speak.py
new file mode 100755
index 00000000..aeaa417f
--- /dev/null
+++ b/cholerab/knut/clients/pidgin_speak/speak.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+import string
+CNOT="../cnot/index %s %s"
+host="pornocauster"
+def speakOwn(account, receiver,message):
+ speak(account,receiver,message,"","");
+def speak(account, sender, message, conversation, flags):
+ bus = dbus.SessionBus()
+ obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
+ purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
+ import subprocess
+ message = message.replace("'",'"')
+ print message
+ #cmd = "espeak -v de '%s'" % message
+ cmd = CNOT % (host,message)
+ subprocess.call(cmd,shell=True)
+import dbus, gobject
+
+from dbus.mainloop.glib import DBusGMainLoop
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+bus = dbus.SessionBus()
+
+bus.add_signal_receiver(speak,
+ dbus_interface="im.pidgin.purple.PurpleInterface",
+ signal_name="ReceivedImMsg")
+
+bus.add_signal_receiver(speakOwn,
+ dbus_interface="im.pidgin.purple.PurpleInterface",
+ signal_name="SentImMsg")
+loop = gobject.MainLoop()
+loop.run()