changeset 4117:273ae8a1a58a HEAD

Don't hide all .files when listing mboxes, only .imap and .subscriptions. Moved the hardcoded ".imap" strings into a define.
author Timo Sirainen <tss@iki.fi>
date Sat, 01 Apr 2006 12:36:25 +0300
parents 9d95aad9e9a7
children b66da5c1a94b
files src/lib-storage/index/mbox/mbox-list.c src/lib-storage/index/mbox/mbox-storage.c src/lib-storage/index/mbox/mbox-storage.h
diffstat 3 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-list.c	Sat Apr 01 12:31:15 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-list.c	Sat Apr 01 12:36:25 2006 +0300
@@ -223,8 +223,10 @@
 	int ret;
 	bool noselect;
 
-	/* skip all hidden files */
-	if (fname[0] == '.')
+	/* skip subscription file and .imap/ directory */
+	if (fname[0] == '.' &&
+	    (strcmp(fname, SUBSCRIPTION_FILE_NAME) == 0 ||
+	     strcmp(fname, MBOX_INDEX_DIR_NAME) == 0))
 		return 0;
 
 	/* skip all .lock files */
--- a/src/lib-storage/index/mbox/mbox-storage.c	Sat Apr 01 12:31:15 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Sat Apr 01 12:36:25 2006 +0300
@@ -150,7 +150,8 @@
 	if (*path != '\0' && mbox_is_file(path, "INBOX file", debug))
 		return TRUE;
 
-	if (mbox_is_dir(t_strconcat(path, "/.imap", NULL), "has .imap/", debug))
+	if (mbox_is_dir(t_strconcat(path, "/"MBOX_INDEX_DIR_NAME, NULL),
+			"has "MBOX_INDEX_DIR_NAME"/", debug))
 		return TRUE;
 	if (mbox_is_file(t_strconcat(path, "/inbox", NULL), "has inbox", debug))
 		return TRUE;
@@ -429,16 +430,17 @@
 		name = home_expand(name);
 		p = strrchr(name, '/');
 		return t_strconcat(t_strdup_until(name, p),
-				   "/.imap/", p+1, NULL);
+				   "/"MBOX_INDEX_DIR_NAME"/", p+1, NULL);
 	}
 
 	p = strrchr(name, '/');
-	if (p == NULL)
-		return t_strconcat(storage->index_dir, "/.imap/", name, NULL);
-	else {
+	if (p == NULL) {
+		return t_strconcat(storage->index_dir,
+				   "/"MBOX_INDEX_DIR_NAME"/", name, NULL);
+	} else {
 		return t_strconcat(storage->index_dir, "/",
 				   t_strdup_until(name, p),
-				   "/.imap/", p+1, NULL);
+				   "/"MBOX_INDEX_DIR_NAME"/", p+1, NULL);
 	}
 }
 
@@ -830,7 +832,7 @@
 		/* deleting a folder, only allow it if it's empty.
 		   Delete .imap folder before to make sure it goes empty. */
 		index_dir = t_strconcat(storage->index_dir, "/", name,
-					"/.imap", NULL);
+					"/"MBOX_INDEX_DIR_NAME, NULL);
 
 		if (index_dir != NULL && rmdir(index_dir) < 0 &&
 		    !ENOTFOUND(errno) && errno != ENOTEMPTY) {
--- a/src/lib-storage/index/mbox/mbox-storage.h	Sat Apr 01 12:31:15 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.h	Sat Apr 01 12:36:25 2006 +0300
@@ -8,6 +8,7 @@
 
 #define SUBSCRIPTION_FILE_NAME ".subscriptions"
 #define MBOX_INDEX_PREFIX "dovecot.index"
+#define MBOX_INDEX_DIR_NAME ".imap"
 
 #include "index-storage.h"