summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-14 16:53:47 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-14 16:53:47 -0400
commit07138146a01d802e4d1b5a7d0ccf4601d89eeef8 (patch)
tree7792f3361e349116c8210a9ef377e24f22c3087a
parentdb213fd0aed98a79ecb1be2c7b7d61c7d983bedf (diff)
downloadaerc-07138146a01d802e4d1b5a7d0ccf4601d89eeef8.tar.gz
Force INBOX to be included in dirlist
-rw-r--r--widgets/dirlist.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index faf73a1..689eb77 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -47,6 +47,17 @@ func (dirlist *DirectoryList) UpdateList(done func(dirs []string)) {
 			case *types.Directory:
 				dirs = append(dirs, msg.Name)
 			case *types.Done:
+				// There is always an INBOX, RFC-guaranteed
+				// However, for some reason Dovecot doesn't always send it.
+				inbox := false
+				for _, dir := range dirs {
+					if dir == "INBOX" {
+						inbox = true
+					}
+				}
+				if !inbox {
+					dirs = append(dirs, "INBOX")
+				}
 				sort.Strings(dirs)
 				dirlist.dirs = dirs
 				dirlist.spinner.Stop()