Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6806:f9e24a274ede HEAD
Return children state based on directory links count if possible.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Nov 2007 08:15:43 +0200 |
parents | b2bcfe178a30 |
children | 5382964fc01d |
files | src/lib-storage/index/cydir/cydir-storage.c src/lib-storage/index/dbox/dbox-storage.c |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ /* 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
--- 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 @@ /* 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