diff options
author | Ben Cohen <ben@bencohen.net> | 2022-10-18 12:03:09 -0400 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-10-18 22:25:46 +0200 |
commit | f7a9454441c4a7a4810862f1511fbff8af33a8b8 (patch) | |
tree | 4f0bf57179f7d4ec683761d20567203b4320955d /worker/maildir/worker.go | |
parent | bad694e466705db83da2e864a3988255eb97055a (diff) | |
download | aerc-f7a9454441c4a7a4810862f1511fbff8af33a8b8.tar.gz |
maildir: make checkmail update directory counts
Non-selected folders will now have their total/unread/new counts updated
in the background when a check-mail happens.
Signed-off-by: Ben Cohen <ben@bencohen.net>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r-- | worker/maildir/worker.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index 3ac8d0b3..ddb1bf68 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -733,6 +733,20 @@ func (w *Worker) handleCheckMail(msg *types.CheckMail) { if err != nil { w.err(msg, fmt.Errorf("checkmail: error running command: %w", err)) } else { + dirs, err := w.c.ListFolders() + if err != nil { + w.err(msg, fmt.Errorf("failed listing directories: %w", err)) + } + for _, name := range dirs { + err := w.c.SyncNewMail(w.c.Dir(name)) + if err != nil { + w.err(msg, fmt.Errorf("could not sync new mail: %w", err)) + } + dirInfo := w.getDirectoryInfo(name) + w.worker.PostMessage(&types.DirectoryInfo{ + Info: dirInfo, + }, nil) + } w.done(msg) } } |