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>
This commit is contained in:
parent
bad694e466
commit
f7a9454441
1 changed files with 14 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue