dovecot-1.1: LIST: Show \NoSelect status correctly.

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 3 06:20:40 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/1d0de3d644e4
changeset: 7324:1d0de3d644e4
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 03 06:20:36 2008 +0200
description:
LIST: Show \NoSelect status correctly.

diffstat:

1 file changed, 9 insertions(+), 3 deletions(-)
src/lib-storage/index/dbox/dbox-storage.c |   12 +++++++++---

diffs (36 lines):

diff -r bbafc37e3251 -r 1d0de3d644e4 src/lib-storage/index/dbox/dbox-storage.c
--- 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 @@ static int dbox_list_iter_is_mailbox(str
 				     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 @@ static int dbox_list_iter_is_mailbox(str
 	}
 
 	/* 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;
@@ -522,6 +522,12 @@ static int dbox_list_iter_is_mailbox(str
 		/* non-selectable. probably either access denied, or symlink
 		   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;
 }


More information about the dovecot-cvs mailing list