changeset 7324:1d0de3d644e4 HEAD

LIST: Show \NoSelect status correctly.
author Timo Sirainen <tss@iki.fi>
date Mon, 03 Mar 2008 06:20:36 +0200
parents bbafc37e3251
children 3bece69a5bfc
files src/lib-storage/index/dbox/dbox-storage.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/dbox-storage.c	Mon Mar 03 06:13:22 2008 +0200
+++ b/src/lib-storage/index/dbox/dbox-storage.c	Mon Mar 03 06:20:36 2008 +0200
@@ -482,7 +482,7 @@
 				     enum mailbox_list_file_type type,
 				     enum mailbox_info_flags *flags)
 {
-	const char *mail_path;
+	const char *path, *maildir_path;
 	struct stat st;
 	int ret = 1;
 
@@ -496,8 +496,8 @@
 	}
 
 	/* need to stat() then */
-	mail_path = t_strconcat(dir, "/", fname, NULL);
-	if (stat(mail_path, &st) == 0) {
+	path = t_strconcat(dir, "/", fname, NULL);
+	if (stat(path, &st) == 0) {
 		if (!S_ISDIR(st.st_mode)) {
 			/* non-directory */
 			*flags |= MAILBOX_NOSELECT | MAILBOX_NOINFERIORS;
@@ -523,6 +523,12 @@
 		   destination not found. don't bother logging errors. */
 		*flags |= MAILBOX_NOSELECT;
 	}
+	if ((*flags & MAILBOX_NOSELECT) == 0) {
+		/* make sure it's a selectable mailbox */
+		maildir_path = t_strconcat(path, "/"DBOX_MAILDIR_NAME, NULL);
+		if (stat(maildir_path, &st) < 0 || !S_ISDIR(st.st_mode))
+			*flags |= MAILBOX_NOSELECT;
+	}
 	return ret;
 }