> >My personal feeling is that this is a bit over elaborate, and I don't
> >like the idea of Exim quotas working differently to system quotas. What
> >are the views of others on this list?
>
> I think you should only do it if the mailbox format supports it
> natively.
>
> For example there is a format called Maildir++ that is being used by
> Courier which is an extended (and backwards compatible) Maildir.
> It supports Maildir quotas. See
>
> http://www.inter7.com/courierimap/README.maildirquota.html
> http://www.inter7.com/courierimap/README.sharedfolders.html
Exim supports maildir as a standard format natively. Recently, Philip
added a feature that allows to encode the message size in the filename,
which is helpful for both maildir and maildir++. Finally, the appended
patch supports maildir folders.
Michael
----------------------------------------------------------------------
--- src/transports/appendfile.c.orig Wed Aug 9 10:38:56 2000
+++ src/transports/appendfile.c Wed Aug 9 10:39:06 2000
@@ -637,7 +637,7 @@
*/
static int
-check_dir_size(char *dirname, int *countptr, pcre *regex)
+check_folder_size(char *dirname, int *countptr, pcre *regex)
{
DIR *dir;
int sum = 0;
@@ -693,7 +693,7 @@
if ((statbuf.st_mode & S_IFREG) != 0)
sum += statbuf.st_size;
else if ((statbuf.st_mode & S_IFDIR) != 0)
- sum += check_dir_size(buffer, &count, regex);
+ sum += check_folder_size(buffer, &count, regex);
}
closedir(dir);
@@ -703,6 +703,34 @@
return sum;
}
+static int
+check_dir_size(char *dirname, int *countptr, pcre *regex)
+{
+char buf[1024];
+struct stat statbuf;
+
+if (!string_format(buf, sizeof(buf), "%s/maildirfolder", dirname))
+ {
+ log_write(0, LOG_PANIC|LOG_MAIN, "name too long in check_dir_size: "
+ "dir=%s", dirname);
+ return 0;
+ }
+
+if (stat(buf, &statbuf) < 0)
+ return check_folder_size(dirname, countptr, regex);
+else
+ {
+ char *slash;
+ if (!string_format(buf, sizeof(buf), "%s", dirname))
+ {
+ log_write(0, LOG_PANIC|LOG_MAIN, "name too long in check_dir_size: "
+ "dir=%s", dirname);
+ return 0;
+ }
+ if ((slash=strrchr(buf,'/'))!=(char*)0) *slash='\0';
+ return check_folder_size(buf, countptr, regex);
+ }
+}