Thu, 26 Oct 2006
E-mail notification via Jabber/iChat
A simple program to get pinged whenever you get new e-mail:
#! /usr/bin/env python
import sys, email
from pyxmpp.jid import JID
from pyxmpp.jabber.simple import send_message
inp = sys.stdin.read()
message = email.message_from_string(inp)
jid = 'someid@xmpp.us'
password, recpt = 'XXXXX', 'otherid@xmpp.us'
jid = JID(jid)
if not jid.resource:
jid = JID(jid.node,jid.domain,"send_message")
recpt = JID(recpt)
s = "From: %s\nSubject: %s" % (message['From'], message['Subject'])
send_message(jid, password, recpt, s, "")
Just pipe each new e-mail message into this, and voila!
I'd like to write something like for buildbot, so that a failing build notifies you. Should be pretty easy.
And, of course, PyXMPP is cool.
--titus
posted at: 17:03 | path: /oct-06 | 5 comments
Comments:
Posted by Grig Gheorghiu at Thu Oct 26 17:35:21 2006:
Cool stuff! Buildbot already has an IRC notifier, but a Jabber one would be a welcome addition I'm sure. Send a patch to the buildbot-devel list!
Posted by Mark Eichin at Fri Oct 27 17:05:51 2006:
Once we added a simple shell "send jabber message to user|group" commandline tool (using python-xmpp which isn't quite this elegant, though it does work with gssapi/kerberos) people started dropping notifications into lots of things. (just like we learned with zwrite/Zephyr at MIT in the early 90's :-) "New release candidate available" or even "pre-installed testing machine ready to ssh into" messages are great for letting people not wait for resources to be available, since they can have the resource interrupt them. Good for productivity though sometimes a little surprising when you get a message from yourself saying something is ready :-)
Posted by John at Thu Nov 2 19:24:22 2006:
Very cool script.
It works great with most Jabber servers (e.g. jabber.org), but for some reason I'm having trouble getting it to work with Google Talk. Any tips?
Posted by Titus Brown at Fri Nov 3 09:03:46 2006:
Sorry, no ideas... does iChat work with Google Talk?
Posted by Titus Brown at Mon Nov 20 10:13:11 2006:
Here's a patch to make PyXMPP work with Google Talk:
http://www.stillhq.com/google/gtalk/000001.html