aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/checkmail.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/worker/imap/checkmail.go b/worker/imap/checkmail.go
index 21f2e4bb..e0aef71b 100644
--- a/worker/imap/checkmail.go
+++ b/worker/imap/checkmail.go
@@ -13,7 +13,13 @@ func (w *IMAPWorker) handleCheckMailMessage(msg *types.CheckMail) {
imap.StatusRecent,
imap.StatusUnseen,
}
+ var remaining []string
for _, dir := range msg.Directories {
+ if len(w.worker.Actions) > 0 {
+ remaining = append(remaining, dir)
+ continue
+ }
+
logging.Debugf("Getting status of directory %s", dir)
status, err := w.client.Status(dir, items)
if err != nil {
@@ -38,5 +44,12 @@ func (w *IMAPWorker) handleCheckMailMessage(msg *types.CheckMail) {
}, nil)
}
}
+ if len(remaining) > 0 {
+ w.worker.PostMessage(&types.CheckMailDirectories{
+ Message: types.RespondTo(msg),
+ Directories: remaining,
+ }, nil)
+ return
+ }
w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
}