[SPAM] Include trashed (\Deleted) messages in quota usage

Teodor Milkov <[email protected]> Tue, 10 Feb 2015 13:21:36 +0200
Newsgroups gmane.mail.vpopmail
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090201010502020806050202
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

Currently vpopmail doesn't include trashed messages in quota usage. 
These are messages that were marked as deleted (IMAP flag \Deleted) but 
are still not expunged. These are denoted by the T flag in Maildir: 
http://cr.yp.to/proto/maildir.html

It seems two of the popular mail servers out there have opposing 
behavior: courier doesn't count trashed messages while dovecot does 
count them.

In my setup I have some users, who seem to forgot to expunge (also known 
as "Compact" in thunderbird) their mailboxes and trahsed messages keep 
piling up and filling filesystems. That's why I prefer including trashed 
messages in quota usage and forcing users to take measures this way.

I guess it'd be best to add a configuration option (either ./configure 
compile time or runtime to some config file), but for my specific case I 
patched maildirquota.c with the attached patch.

HTH someone.


Best regards,
Teodor


!DSPAM:54d9e9c441146365629053!

--------------090201010502020806050202
Content-Type: text/x-patch;
 name="40-vpopmail-count-trashed.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="40-vpopmail-count-trashed.patch"

--- maildirquota.h.orig	2015-02-03 14:34:30.000000000 +0200
+++ maildirquota.h	2015-02-03 14:19:38.000000000 +0200
@@ -16,6 +16,12 @@
 #define MAILDIRSIZE_OVERLEN 5120
 #define MAILDIRSIZE_OLD_SECS 15*60
 
+/*
+ * Count messages marked as deleted, but still not expunged:
+ * http://cr.yp.to/proto/maildir.html
+ */
+#define QUOTA_COUNT_TRASHED 1
+
 /* I've removed pretty much the whole file execept for
    some public functions so as to not conflict with courier.
    I"ve made the courier functions static.
--- maildirquota.c.orig	2015-02-03 13:15:37.000000000 +0200
+++ maildirquota.c	2015-02-03 14:35:47.000000000 +0200
@@ -990,9 +990,7 @@
 	const char *n=de->d_name;
 
 		if (*n == '.')	continue;
-
-		/* PATCH - do not count msgs marked as deleted */
-
+#if QUOTA_COUNT_TRASHED == 0
 		for ( ; *n; n++)
 		{
 			if (n[0] != ':' || n[1] != '2' ||
@@ -1006,6 +1004,7 @@
 			break;
 		}
 		if (*n == 'T')	continue;
+#endif
 		n=de->d_name;
 
 

--------------090201010502020806050202--