dovecot: Mark lazy expunge's namespaces as internal so quota doe...

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 22 15:49:43 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/d4df001f9bd0
changeset: 6460:d4df001f9bd0
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 22 15:49:28 2007 +0300
description:
Mark lazy expunge's namespaces as internal so quota doesn't count them.

diffstat:

1 file changed, 16 insertions(+), 3 deletions(-)
src/plugins/lazy-expunge/lazy-expunge-plugin.c |   19 ++++++++++++++++---

diffs (50 lines):

diff -r c6849b4a3812 -r d4df001f9bd0 src/plugins/lazy-expunge/lazy-expunge-plugin.c
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Sat Sep 22 15:49:02 2007 +0300
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Sat Sep 22 15:49:28 2007 +0300
@@ -475,6 +475,8 @@ static void lazy_expunge_mail_storage_cr
 	struct lazy_expunge_mailbox_list *llist =
 		LAZY_EXPUNGE_LIST_CONTEXT(storage->list);
 	struct lazy_expunge_mail_storage *lstorage;
+	const char *const *p;
+	unsigned int i;
 
 	if (lazy_expunge_next_hook_mail_storage_created != NULL)
 		lazy_expunge_next_hook_mail_storage_created(storage);
@@ -483,6 +485,18 @@ static void lazy_expunge_mail_storage_cr
 	if (strcmp(storage->name, "maildir") != 0)
 		return;
 
+	/* if this is one of our internal storages, mark it as such before
+	   quota plugin sees it */
+	t_push();
+	p = t_strsplit_spaces(getenv("LAZY_EXPUNGE"), " ");
+	for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) {
+		if (strcmp(storage->ns->prefix, *p) == 0) {
+			lazy_namespaces[i]->flags |= NAMESPACE_FLAG_INTERNAL;
+			break;
+		}
+	}
+	t_pop();
+
 	llist->storage = storage;
 
 	lstorage = p_new(storage->pool, struct lazy_expunge_mail_storage, 1);
@@ -517,7 +531,7 @@ lazy_expunge_hook_mail_namespaces_create
 		lazy_expunge_next_hook_mail_namespaces_created(namespaces);
 
 	t_push();
-	p = t_strsplit(getenv("LAZY_EXPUNGE"), " ");
+	p = t_strsplit_spaces(getenv("LAZY_EXPUNGE"), " ");
 	for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) {
 		const char *name = *p;
 
@@ -551,8 +565,7 @@ void lazy_expunge_plugin_init(void)
 	hook_mail_namespaces_created =
 		lazy_expunge_hook_mail_namespaces_created;
 
-	lazy_expunge_next_hook_mail_storage_created =
-		hook_mail_storage_created;
+	lazy_expunge_next_hook_mail_storage_created = hook_mail_storage_created;
 	hook_mail_storage_created = lazy_expunge_mail_storage_created;
 
 	lazy_expunge_next_hook_mailbox_list_created = hook_mailbox_list_created;


More information about the dovecot-cvs mailing list