If anyone's interested about implementing quota code for Dovecot (there were a few of you before! :), now it's finally your chance to do it quite easily.
With the API changes committed today to CVS, it's now much easier to write plugins that modify mail-storage behavior. So, I finally fixed my half-working quota plugin that had been lying there for a while. It implements the RFC2087 quota commands for IMAP, a generic quota API that should allow pretty much any kind of quota implementation, and the actual quota limit checking for saving and copying mails. As an example there's an implementation which just scans through all files in a directory and sums their sizes.
Currently it can be made to work only when starting from command line, eg.:
export QUOTA=~/mail:storage=1024 export MODULE_DIR=/usr/local/lib/dovecot/imap ./imap
The QUOTA variable is passed to the quota implementation. In this case quota-dirsize reads it, figures out that ~/mail is the directory where to count the files, and 1024kB is the maximum for quota.
I think I'll change the master process code so that any unrecognized varibles that come from userdb are fed to imap/pop3 processes. That way you could simply make the userdb return the quota value (and set other user-specific settings as well).
Available from:
http://dovecot.org/patches/1.0/quota.tar.gz
Unpack under dovecot/src, compile command is at the beginning of quota-plugin.c
I'm still wondering where this code should be placed. Maybe the core implementation should be built into Dovecot, while the different quota implementations would be plugins? ..And even better would be if Dovecot's build process was modified so that it's possible to specify with configure script what to compile in and what to compile as plugins..
Anyway, comments welcome, Maildir++ implementation welcome, other implementations welcome as well :)