summaryrefslogtreecommitdiffstats
path: root/cholerab/knut
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-08-14 22:03:11 +0200
committermakefu <github@syntax-fehler.de>2011-08-14 22:03:11 +0200
commit84f25017f61d87c592bcc4519bee56e49fe66083 (patch)
treeb27e2e3cb28b8b4ecbb3e9ba2004966241262c85 /cholerab/knut
parent13092c905de4f43c429edb004fd080fcb2ee5cbd (diff)
pidgin_speak: initial commit
Diffstat (limited to 'cholerab/knut')
-rw-r--r--cholerab/knut/Makefile2
-rwxr-xr-xcholerab/knut/clients/pidgin_speak/speak.py31
2 files changed, 32 insertions, 1 deletions
diff --git a/cholerab/knut/Makefile b/cholerab/knut/Makefile
index ee422fd9..bb2aa905 100644
--- a/cholerab/knut/Makefile
+++ b/cholerab/knut/Makefile
@@ -10,7 +10,7 @@ install: \
../../bin/cnot \
../../bin/clive-knut \
../../bin/ttycnser-login
- ../../punani/bin/punani -Ei python python-notify
+ ../../punani/bin/punani -Ei python python-notify dbus-python
../../bin/cnot: clients/cnot/index
ln -vsnf ../cholerab/knut/$< $@
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()