diff options
Diffstat (limited to 'worker/notmuch/eventhandlers.go')
-rw-r--r-- | worker/notmuch/eventhandlers.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go index 7b3c5174..764add0c 100644 --- a/worker/notmuch/eventhandlers.go +++ b/worker/notmuch/eventhandlers.go @@ -3,7 +3,12 @@ package notmuch -import "git.sr.ht/~rjarry/aerc/logging" +import ( + "fmt" + "strconv" + + "git.sr.ht/~rjarry/aerc/logging" +) func (w *worker) handleNotmuchEvent(et eventType) error { switch ev := et.(type) { @@ -15,6 +20,21 @@ func (w *worker) handleNotmuchEvent(et eventType) error { } func (w *worker) handleUpdateDirCounts(ev eventType) error { + folders, err := w.store.FolderMap() + if err != nil { + logging.Errorf("failed listing directories: %v", err) + return err + } + for name := range folders { + query := fmt.Sprintf("folder:%s", strconv.Quote(name)) + info, err := w.buildDirInfo(name, query, true) + if err != nil { + logging.Errorf("could not gather DirectoryInfo: %v", err) + continue + } + w.w.PostMessage(info, nil) + } + for name, query := range w.nameQueryMap { info, err := w.buildDirInfo(name, query, true) if err != nil { |