So I've written a quick hack. A client-side filter/utility program for working against IMAP servers.
Consider it a general purpose system which is similar to Procmail, but applied after your remote machine has already done the sorting.
Here's a flavour:
<GMail> username somebody.like.me password yeah.right </Gmail> <Folders> <livejournal> unread exec /usr/local/bin/notify "Livejournal Comment" mark read </livejournal> <inbox> mark read </inbox> </Folder>
What does that do? It first of all logs into GMail with the given username and password, then selects two folders:
- =livejournal/
For each unread message in the folder it runs the specified command with STDIN being the message body.
Then it marks each new message as "read".
- =inbox/
This simple rule just marks all messages as read.
Why? Well I have a bunch of folders on a bunch of gmail accounts and I don't pay attention to them - but some, specific, mails should result in an SMS being sent to me ... so I need to do something clever.
I'm sure with a bit of effort this could be made IMAP-server independent, and could have a more flexible matching system. The simplicity right now comes about primarily because i dont want to parse a config file.
Anyway, suggestions for potential features are welcome. It does what I need as-is, even if it isn't pretty.
ObQuote: Lost Boys