changeset 6460:d4df001f9bd0 HEAD

Mark lazy expunge's namespaces as internal so quota doesn't count them.
author Timo Sirainen <tss@iki.fi>
date Sat, 22 Sep 2007 15:49:28 +0300
parents c6849b4a3812
children c057369df638
files src/plugins/lazy-expunge/lazy-expunge-plugin.c
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	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 @@
 	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_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 @@
 	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;