dovecot-2.1: lib-storage: Handle INBOX in the common mailbox_exi...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 12 13:14:36 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/3844653d483a
changeset: 13445:3844653d483a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 12 13:13:35 2011 +0300
description:
lib-storage: Handle INBOX in the common mailbox_exists() code.

diffstat:

 src/lib-storage/index/index-storage.c           |  17 ++++-------------
 src/lib-storage/index/index-storage.h           |   3 +--
 src/lib-storage/index/maildir/maildir-storage.c |   8 ++++----
 src/lib-storage/mail-storage.c                  |   6 ++++++
 4 files changed, 15 insertions(+), 19 deletions(-)

diffs (84 lines):

diff -r 59c7b30973cf -r 3844653d483a src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Mon Sep 12 12:41:09 2011 +0300
+++ b/src/lib-storage/index/index-storage.c	Mon Sep 12 13:13:35 2011 +0300
@@ -151,28 +151,19 @@
 					  box->index_prefix);
 }
 
-int index_storage_mailbox_exists(struct mailbox *box, bool auto_boxes,
+int index_storage_mailbox_exists(struct mailbox *box,
+				 bool auto_boxes ATTR_UNUSED,
 				 enum mailbox_existence *existence_r)
 {
-	return index_storage_mailbox_exists_full(box, auto_boxes,
-						 NULL, existence_r);
+	return index_storage_mailbox_exists_full(box, NULL, existence_r);
 }
 
-int index_storage_mailbox_exists_full(struct mailbox *box, bool auto_boxes,
-				      const char *subdir,
+int index_storage_mailbox_exists_full(struct mailbox *box, const char *subdir,
 				      enum mailbox_existence *existence_r)
 {
 	struct stat st;
 	const char *path, *path2;
 
-	if (strcmp(box->name, "INBOX") == 0 &&
-	    (box->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 &&
-	    auto_boxes) {
-		/* INBOX always exists */
-		*existence_r = MAILBOX_EXISTENCE_SELECT;
-		return 0;
-	}
-
 	/* see if it's selectable */
 	path = mailbox_list_get_path(box->list, box->name,
 				     MAILBOX_LIST_PATH_TYPE_MAILBOX);
diff -r 59c7b30973cf -r 3844653d483a src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h	Mon Sep 12 12:41:09 2011 +0300
+++ b/src/lib-storage/index/index-storage.h	Mon Sep 12 13:13:35 2011 +0300
@@ -59,8 +59,7 @@
 				 const char *index_prefix);
 int index_storage_mailbox_exists(struct mailbox *box, bool auto_boxes,
 				 enum mailbox_existence *existence_r);
-int index_storage_mailbox_exists_full(struct mailbox *box, bool auto_boxes,
-				      const char *subdir,
+int index_storage_mailbox_exists_full(struct mailbox *box, const char *subdir,
 				      enum mailbox_existence *existence_r);
 int index_storage_mailbox_open(struct mailbox *box, bool move_to_memory);
 int index_storage_mailbox_enable(struct mailbox *box,
diff -r 59c7b30973cf -r 3844653d483a src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Mon Sep 12 12:41:09 2011 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Mon Sep 12 13:13:35 2011 +0300
@@ -323,11 +323,11 @@
 	return FALSE;
 }
 
-static int maildir_mailbox_exists(struct mailbox *box, bool auto_boxes,
-				  enum mailbox_existence *existence_r)
+static int
+maildir_mailbox_exists(struct mailbox *box, bool auto_boxes ATTR_UNUSED,
+		       enum mailbox_existence *existence_r)
 {
-	return index_storage_mailbox_exists_full(box, auto_boxes,
-						 "cur", existence_r);
+	return index_storage_mailbox_exists_full(box, "cur", existence_r);
 }
 
 static int maildir_mailbox_open(struct mailbox *box)
diff -r 59c7b30973cf -r 3844653d483a src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Mon Sep 12 12:41:09 2011 +0300
+++ b/src/lib-storage/mail-storage.c	Mon Sep 12 13:13:35 2011 +0300
@@ -694,6 +694,12 @@
 		return 0;
 	}
 
+	if (strcmp(box->name, "INBOX") == 0 && box->inbox_user && auto_boxes) {
+		/* INBOX always exists */
+		*existence_r = MAILBOX_EXISTENCE_SELECT;
+		return 0;
+	}
+
 	return box->v.exists(box, auto_boxes, existence_r);
 }
 


More information about the dovecot-cvs mailing list