changeset 5567:eb8dc8a79d5d HEAD

Removed HAS_INBOX and SHARED_NAMESPACE flags from mail storage and mailbox list flags. They can be directly taken from struct mail_namespace.
author Timo Sirainen <tss@iki.fi>
date Tue, 17 Apr 2007 18:39:30 +0300
parents 88307a648e0e
children cce4074b7876
files src/lib-storage/list/mailbox-list-fs-iter.c src/lib-storage/list/mailbox-list-maildir-iter.c src/lib-storage/mail-namespace.c src/lib-storage/mail-storage.c src/lib-storage/mail-storage.h src/lib-storage/mailbox-list-private.h src/lib-storage/mailbox-list.h src/plugins/convert/convert-storage.c src/plugins/quota/quota-storage.c
diffstat 9 files changed, 7 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Tue Apr 17 18:39:30 2007 +0300
@@ -259,8 +259,7 @@
 
 	/* make sure we give only one correct INBOX */
 	real_path = t_strconcat(ctx->dir->real_path, "/", fname, NULL);
-	if ((ctx->ctx.list->flags & MAILBOX_LIST_FLAG_INBOX) != 0 &&
-	    strcasecmp(list_path, "INBOX") == 0) {
+	if (ctx->ctx.list->ns->inbox && strcasecmp(list_path, "INBOX") == 0) {
 		if (ctx->inbox_listed) {
 			/* already listed the INBOX */
 			return 0;
@@ -417,8 +416,7 @@
 		list_dir_context_free(dir);
 	}
 
-	if (!ctx->inbox_found &&
-	    (ctx->ctx.list->flags & MAILBOX_LIST_FLAG_INBOX) != 0 &&
+	if (!ctx->inbox_found && ctx->ctx.list->ns->inbox &&
 	    ctx->glob != NULL && imap_match(ctx->glob, "INBOX") > 0) {
 		/* show inbox */
 		ctx->inbox_listed = TRUE;
--- a/src/lib-storage/list/mailbox-list-maildir-iter.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-maildir-iter.c	Tue Apr 17 18:39:30 2007 +0300
@@ -160,7 +160,7 @@
 		return -1;
 	}
 
-	if ((ctx->ctx.list->flags & MAILBOX_LIST_FLAG_INBOX) != 0 &&
+	if (ctx->ctx.list->ns->inbox &&
 	    (ctx->ctx.flags & MAILBOX_LIST_ITER_SUBSCRIBED) == 0) {
 		/* make sure INBOX is there */
 		node = mailbox_tree_get(ctx->tree_ctx, "INBOX", &created);
--- a/src/lib-storage/mail-namespace.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/mail-namespace.c	Tue Apr 17 18:39:30 2007 +0300
@@ -54,11 +54,6 @@
 		return NULL;
 	}
 
-	if (ns->type != NAMESPACE_PRIVATE)
-		flags |= MAIL_STORAGE_FLAG_SHARED_NAMESPACE;
-	if (ns->inbox)
-		flags |= MAIL_STORAGE_FLAG_HAS_INBOX;
-
 	if (prefix == NULL)
 		prefix = "";
 
@@ -136,7 +131,6 @@
 	ns->subscriptions = TRUE;
 	ns->prefix = "";
 
-	flags |= MAIL_STORAGE_FLAG_HAS_INBOX;
 	if (mail_storage_create(ns, NULL, mail, user, flags, lock_method) < 0) {
 		if (mail != NULL && *mail != '\0')
 			i_error("Failed to create storage with data: %s", mail);
@@ -163,6 +157,7 @@
 
 	ns = p_new(pool, struct mail_namespace, 1);
 	ns->prefix = "";
+	ns->inbox = TRUE;
 	return ns;
 }
 
--- a/src/lib-storage/mail-storage.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/mail-storage.c	Tue Apr 17 18:39:30 2007 +0300
@@ -401,8 +401,6 @@
 
 	if ((storage_flags & MAIL_STORAGE_FLAG_DEBUG) != 0)
 		list_flags |= MAILBOX_LIST_FLAG_DEBUG;
-	if ((storage_flags & MAIL_STORAGE_FLAG_HAS_INBOX) != 0)
-		list_flags |= MAILBOX_LIST_FLAG_INBOX;
 	if ((storage_flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0)
 		list_flags |= MAILBOX_LIST_FLAG_FULL_FS_ACCESS;
 	if ((storage_flags & MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL) != 0)
--- a/src/lib-storage/mail-storage.h	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/mail-storage.h	Tue Apr 17 18:39:30 2007 +0300
@@ -24,8 +24,6 @@
 	MAIL_STORAGE_FLAG_KEEP_HEADER_MD5	= 0x10,
 	/* Use CRLF linefeeds when saving mails. */
 	MAIL_STORAGE_FLAG_SAVE_CRLF		= 0x40,
-	/* The storage points to shared namespaces */
-	MAIL_STORAGE_FLAG_SHARED_NAMESPACE	= 0x80,
 	/* Don't try to autodetect anything, require that the given data 
 	   contains all the necessary information. */
 	MAIL_STORAGE_FLAG_NO_AUTODETECTION	= 0x100,
@@ -33,9 +31,7 @@
 	   fail to create the storage. */
 	MAIL_STORAGE_FLAG_NO_AUTOCREATE		= 0x200,
 	/* Rely on O_EXCL when creating dotlocks */
-	MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL	= 0x400,
-	/* Ths storage contains INBOX */
-	MAIL_STORAGE_FLAG_HAS_INBOX		= 0x800
+	MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL	= 0x400
 };
 
 enum mailbox_open_flags {
--- a/src/lib-storage/mailbox-list-private.h	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/mailbox-list-private.h	Tue Apr 17 18:39:30 2007 +0300
@@ -6,6 +6,7 @@
 #define MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND "Mailbox doesn't exist: %s"
 #define MAILBOX_LIST_ERR_NO_PERMISSION "Permission denied"
 
+#include "mail-namespace.h"
 #include "mailbox-list.h"
 
 struct dirent;
--- a/src/lib-storage/mailbox-list.h	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/lib-storage/mailbox-list.h	Tue Apr 17 18:39:30 2007 +0300
@@ -8,8 +8,6 @@
 enum mailbox_list_flags {
 	/* Print debugging information while initializing the driver */
 	MAILBOX_LIST_FLAG_DEBUG			= 0x01,
-	/* This mailbox list contains INBOX. Match case-insensitively for it. */
-	MAILBOX_LIST_FLAG_INBOX			= 0x02,
 	/* Allow full filesystem access with absolute or relative paths. */
 	MAILBOX_LIST_FLAG_FULL_FS_ACCESS	= 0x04,
 	/* Rely on O_EXCL when creating dotlocks */
--- a/src/plugins/convert/convert-storage.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/plugins/convert/convert-storage.c	Tue Apr 17 18:39:30 2007 +0300
@@ -270,7 +270,6 @@
 
 	source_ns = mail_namespaces_init_empty(pool_datastack_create());
 	mail_storage_parse_env(&src_flags, &lock_method);
-	src_flags |= MAIL_STORAGE_FLAG_HAS_INBOX;
 	dest_flags = src_flags;
 
 	src_flags |= MAIL_STORAGE_FLAG_NO_AUTOCREATE;
--- a/src/plugins/quota/quota-storage.c	Tue Apr 17 18:33:23 2007 +0300
+++ b/src/plugins/quota/quota-storage.c	Tue Apr 17 18:39:30 2007 +0300
@@ -452,7 +452,7 @@
 
 	MODULE_CONTEXT_SET_SELF(storage, quota_storage_module, qstorage);
 
-	if ((storage->flags & MAIL_STORAGE_FLAG_SHARED_NAMESPACE) == 0) {
+	if (storage->ns->type == NAMESPACE_PRIVATE) {
 		/* register to user's quota roots */
 		quota_add_user_storage(quota_set, storage);
 	}