dovecot: Return children state based on directory links count if...

dovecot at dovecot.org dovecot at dovecot.org
Thu Nov 15 08:15:47 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/f9e24a274ede
changeset: 6806:f9e24a274ede
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 15 08:15:43 2007 +0200
description:
Return children state based on directory links count if possible.

diffstat:

2 files changed, 30 insertions(+)
src/lib-storage/index/cydir/cydir-storage.c |   15 +++++++++++++++
src/lib-storage/index/dbox/dbox-storage.c   |   15 +++++++++++++++

diffs (50 lines):

diff -r b2bcfe178a30 -r f9e24a274ede src/lib-storage/index/cydir/cydir-storage.c
--- a/src/lib-storage/index/cydir/cydir-storage.c	Thu Nov 15 08:14:51 2007 +0200
+++ b/src/lib-storage/index/cydir/cydir-storage.c	Thu Nov 15 08:15:43 2007 +0200
@@ -358,6 +358,21 @@ static int cydir_list_iter_is_mailbox(st
 			/* non-directory */
 			*flags |= MAILBOX_NOSELECT | MAILBOX_NOINFERIORS;
 			ret = 0;
+		} else if (st.st_nlink == 2) {
+			/* no subdirectories */
+			*flags |= MAILBOX_NOCHILDREN;
+		} else if (*ctx->list->set.maildir_name != '\0') {
+			/* non-default configuration: we have one directory
+			   containing the mailboxes. if there are 3 links,
+			   either this is a selectable mailbox without children
+			   or non-selectable mailbox with children */
+			if (st.st_nlink > 3)
+				*flags |= MAILBOX_CHILDREN;
+		} else {
+			/* default configuration: all subdirectories are
+			   child mailboxes. */
+			if (st.st_nlink > 2)
+				*flags |= MAILBOX_CHILDREN;
 		}
 	} else {
 		/* non-selectable. probably either access denied, or symlink
diff -r b2bcfe178a30 -r f9e24a274ede src/lib-storage/index/dbox/dbox-storage.c
--- a/src/lib-storage/index/dbox/dbox-storage.c	Thu Nov 15 08:14:51 2007 +0200
+++ b/src/lib-storage/index/dbox/dbox-storage.c	Thu Nov 15 08:15:43 2007 +0200
@@ -437,6 +437,21 @@ static int dbox_list_iter_is_mailbox(str
 			/* non-directory */
 			*flags |= MAILBOX_NOSELECT | MAILBOX_NOINFERIORS;
 			ret = 0;
+		} else if (st.st_nlink == 2) {
+			/* no subdirectories */
+			*flags |= MAILBOX_NOCHILDREN;
+		} else if (*ctx->list->set.maildir_name != '\0') {
+			/* default configuration: we have one directory
+			   containing the mailboxes. if there are 3 links,
+			   either this is a selectable mailbox without children
+			   or non-selectable mailbox with children */
+			if (st.st_nlink > 3)
+				*flags |= MAILBOX_CHILDREN;
+		} else {
+			/* non-default configuration: all subdirectories are
+			   child mailboxes. */
+			if (st.st_nlink > 2)
+				*flags |= MAILBOX_CHILDREN;
 		}
 	} else {
 		/* non-selectable. probably either access denied, or symlink


More information about the dovecot-cvs mailing list