dovecot-1.2: Maildir: Fixed to work with LAYOUT=fs and non-empty...

dovecot at dovecot.org dovecot at dovecot.org
Sat Nov 15 18:48:56 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/ce4779b95fc8
changeset: 8400:ce4779b95fc8
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Nov 15 18:48:52 2008 +0200
description:
Maildir: Fixed to work with LAYOUT=fs and non-empty DIRNAME.

diffstat:

1 file changed, 26 insertions(+), 12 deletions(-)
src/lib-storage/index/maildir/maildir-storage.c |   38 +++++++++++++++--------

diffs (49 lines):

diff -r 155700456194 -r ce4779b95fc8 src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sat Nov 15 18:43:54 2008 +0200
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sat Nov 15 18:48:52 2008 +0200
@@ -930,19 +930,33 @@ maildir_list_iter_is_mailbox(struct mail
 		if (stat(cur_path, &st2) < 0 || !S_ISDIR(st2.st_mode))
 			*flags |= MAILBOX_NOSELECT;
 
-		/* now we can figure out based on the link count if we have
-		   child mailboxes or not. for a selectable mailbox we have
-		   3 more links (cur/, new/ and tmp/) than non-selectable. */
-		if ((*flags & MAILBOX_NOSELECT) == 0) {
-			if (st.st_nlink > 5)
+		if (*ctx->list->set.maildir_name == '\0') {
+			/* now we can figure out based on the link count if we
+			   have child mailboxes or not. for a selectable
+			   mailbox we have 3 more links (cur/, new/ and tmp/)
+			   than non-selectable. */
+			if ((*flags & MAILBOX_NOSELECT) == 0) {
+				if (st.st_nlink > 5)
+					*flags |= MAILBOX_CHILDREN;
+				else
+					*flags |= MAILBOX_NOCHILDREN;
+			} else {
+				if (st.st_nlink > 2)
+					*flags |= MAILBOX_CHILDREN;
+				else
+					*flags |= MAILBOX_NOCHILDREN;
+			}
+		} else {
+			/* link count 3 may mean either a selectable mailbox
+			   or a non-selectable mailbox with 1 child. */
+			if (st.st_nlink > 3)
 				*flags |= MAILBOX_CHILDREN;
-			else
-				*flags |= MAILBOX_NOCHILDREN;
-		} else {
-			if (st.st_nlink > 2)
-				*flags |= MAILBOX_CHILDREN;
-			else
-				*flags |= MAILBOX_NOCHILDREN;
+			else if (st.st_nlink == 3) {
+				if ((*flags & MAILBOX_NOSELECT) != 0)
+					*flags |= MAILBOX_CHILDREN;
+				else
+					*flags |= MAILBOX_NOCHILDREN;
+			}
 		}
 	}
 	return 1;


More information about the dovecot-cvs mailing list