[dovecot-cvs] dovecot/src/plugins/quota quota-maildir.c,1.21,1.22

tss at dovecot.org tss at dovecot.org
Fri Feb 16 20:21:32 UTC 2007


Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv1282

Modified Files:
	quota-maildir.c 
Log Message:
We were relying on the limits in maildirsize file instead of using the
quota_rule limits.



Index: quota-maildir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-maildir.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- quota-maildir.c	26 Jan 2007 13:58:56 -0000	1.21
+++ quota-maildir.c	16 Feb 2007 20:21:30 -0000	1.22
@@ -32,6 +32,7 @@
 	int fd;
 	time_t recalc_last_stamp;
 
+	unsigned int limits_initialized:1;
 	unsigned int master_message_limits:1;
 };
 
@@ -483,10 +484,25 @@
 	return ret;
 }
 
+static void maildirquota_init_limits(struct maildir_quota_root *root)
+{
+	root->limits_initialized = TRUE;
+
+	if (root->root.default_rule.bytes_limit != 0 ||
+	    root->root.default_rule.count_limit != 0) {
+		root->master_message_limits = TRUE;
+		root->message_bytes_limit = root->root.default_rule.bytes_limit;
+		root->message_count_limit = root->root.default_rule.count_limit;
+	}
+}
+
 static int maildirquota_refresh(struct maildir_quota_root *root)
 {
 	int ret;
 
+	if (!root->limits_initialized)
+		maildirquota_init_limits(root);
+
 	ret = maildirsize_read(root);
 	if (ret == 0) {
 		if (root->message_bytes_limit == (uint64_t)-1 &&



More information about the dovecot-cvs mailing list