changeset 5886:86f22b84e008 HEAD

Don't auto-create INBOX if namespace doesn't have INBOX.
author Timo Sirainen <tss@iki.fi>
date Tue, 03 Jul 2007 18:34:31 +0300
parents f0685f6ec951
children 3f2eb1b9c555
files src/lib-storage/index/maildir/maildir-storage.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c	Tue Jul 03 18:34:47 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Tue Jul 03 18:34:31 2007 +0300
@@ -285,7 +285,8 @@
 				    "tmp/", storage->temp_prefix, NULL);
 	}
 
-	(void)verify_inbox(_storage);
+	if ((_storage->ns->flags & NAMESPACE_FLAG_INBOX) != 0)
+		(void)verify_inbox(_storage);
 	return 0;
 }
 
@@ -507,7 +508,8 @@
 		return NULL;
 	}
 
-	if (strcmp(name, "INBOX") == 0) {
+	if (strcmp(name, "INBOX") == 0 &&
+	    (_storage->ns->flags & NAMESPACE_FLAG_INBOX) != 0) {
 		if (verify_inbox(_storage) < 0)
 			return NULL;
 		return maildir_open(storage, "INBOX", flags);
@@ -956,12 +958,15 @@
 
 	/* Check files beginning with .nfs always because they may be
 	   temporary files created by the kernel */
-	if (storage->stat_dirs || strncmp(fname, ".nfs", 4) == 0) {
+	if (storage->stat_dirs || *fname == '\0' ||
+	    strncmp(fname, ".nfs", 4) == 0) {
 		const char *path;
 		struct stat st;
 
 		t_push();
-		path = t_strdup_printf("%s/%s", dir, fname);
+		/* if fname="", we're checking if a base maildir has INBOX */
+		path = *fname == '\0' ? t_strdup_printf("%s/cur", dir) :
+			t_strdup_printf("%s/%s", dir, fname);
 		if (stat(path, &st) == 0) {
 			if (S_ISDIR(st.st_mode))
 				ret = 1;