aboutsummaryrefslogtreecommitdiff
path: root/worker/imap
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/list.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 75f189f..6aecbca 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -12,6 +12,10 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
go func() {
for mbox := range mailboxes {
+ if !canOpen(mbox) {
+ // no need to pass this to handlers if it can't be opened
+ continue
+ }
imapw.worker.PostMessage(&types.Directory{
Message: types.RespondTo(msg),
Name: mbox.Name,
@@ -30,3 +34,12 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
&types.Done{types.RespondTo(msg)}, nil)
}
}
+
+func canOpen(mbox *imap.MailboxInfo) bool {
+ for _, attr := range mbox.Attributes {
+ if attr == imap.NoSelectAttr {
+ return false
+ }
+ }
+ return true
+}