about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/list.go13
-rw-r--r--worker/imap/worker.go4
2 files changed, 16 insertions, 1 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 5e282ef..552fb45 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -17,6 +17,19 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
 				// no need to pass this to handlers if it can't be opened
 				continue
 			}
+			if len(imapw.config.folders) > 0 {
+				// apply user filter
+				found := false
+				for _, folder := range imapw.config.folders {
+					if folder == mbox.Name || imapw.selected.Name == mbox.Name {
+						found = true
+						break
+					}
+				}
+				if !found {
+					continue
+				}
+			}
 			imapw.worker.PostMessage(&types.Directory{
 				Message:    types.RespondTo(msg),
 				Name:       mbox.Name,
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index d978755..aa59c27 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 
 	"github.com/emersion/go-imap"
-	"github.com/emersion/go-imap-idle"
+	idle "github.com/emersion/go-imap-idle"
 	"github.com/emersion/go-imap/client"
 
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
@@ -26,6 +26,7 @@ type IMAPWorker struct {
 		insecure bool
 		addr     string
 		user     *url.Userinfo
+		folders  []string
 	}
 
 	client   *imapClient
@@ -75,6 +76,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
 		}
 
 		w.config.user = u.User
+		w.config.folders = msg.Config.Folders
 	case *types.Connect:
 		var (
 			c   *client.Client