maildir: hide invalid folders
The maildir worker currently populates the list of mail folders by listing all the filesystem subdirectories in the maildir directory. Although there's no official specification for maildir subfolders, they should all have cur/ new/ and tmp/ subdirectories to be valid. This patch prevents directories that don't have those subdirectories present on the filesystem from appearing in the account folder list. This is useful for example to prevent ".notmuch" and ".notmuch/xapian" from showing up in the folder list if using notmuch to index emails while using aerc's maildir backend. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
parent
8cd4770f32
commit
150aa0f498
1 changed files with 7 additions and 0 deletions
|
@ -78,6 +78,13 @@ func (c *Container) ListFolders() ([]string, error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drop dirs that lack {new,tmp,cur} subdirs
|
||||||
|
for _, sub := range []string{"new", "tmp", "cur"} {
|
||||||
|
if _, err := os.Stat(filepath.Join(path, sub)); os.IsNotExist(err) {
|
||||||
|
return filepath.SkipDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if c.maildirpp {
|
if c.maildirpp {
|
||||||
// In Maildir++ layout, mailboxes are stored in a single directory
|
// In Maildir++ layout, mailboxes are stored in a single directory
|
||||||
// and prefixed with a dot, and subfolders are separated by dots.
|
// and prefixed with a dot, and subfolders are separated by dots.
|
||||||
|
|
Loading…
Reference in a new issue