As some of you may know, Cyrus has a hook that allows new mail notifications
to be implemented. It comes with a Zephyr notification hook.

Creating your own notification hook requires writing a C function and
compiling it in. I'm not that keen on that approach for two reasons:

* I'm no C guru
* I don't want to recompile the server just to change the notification code.

So, I've written a little C function that simply passes notifications on to
a Unix socket. I've also written a pre-forking Perl daemon that listens for
these notifications and reads in the information passed to the notify()
function. These are both attached. All you have to do then is add the Perl
code to implement whatever notification you need (e.g. through instant
messaging, SMS, etc). Search for 'TODO' in the Perl code to find where to
add it.

To add the notify hook, copy notify_unix.c into the imap/ subdir of your
distribution, and then add '--with-notify=unix' to your ./configure line
before you make.

Finally, there's a little shell script attached that let's you say 'notify
start' and 'notify stop' to control the Perl daemon.

The current notify() code does no error checking--I played around with using
non-blocking sockets and select() to make things a bit more solid, but in
the end I went with this more simple approach... This way even if the Perl
daemon dies, the deliver process won't wait.

I'd like to see something like this generic notify hook added to the
distribution--what do others think? The Perl daemon needn't necessarily be
included, although I think that would be handy too.

notify_unix.pl

notify_unix.c

notify

Reply via email to