summary refs log tree commit diff stats
path: root/worker/notmuch/eventhandlers.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-02-15 14:14:47 +0100
committerDrew DeVault <sir@cmpwn.com>2020-02-16 10:41:19 -0500
commit78dd043057af9ccf82d1d7ea1f316f2d55b769c2 (patch)
treed745dd8e30d399a7fed1757d35cec4dfed0ea140 /worker/notmuch/eventhandlers.go
parent8d216ab10e6d43c44ca47ccd44fe7f3d40f1b1c3 (diff)
downloadaerc-78dd043057af9ccf82d1d7ea1f316f2d55b769c2.tar.gz
notmuch: refresh dirlist in background
Diffstat (limited to 'worker/notmuch/eventhandlers.go')
-rw-r--r--worker/notmuch/eventhandlers.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go
index 39027b6..e279dbc 100644
--- a/worker/notmuch/eventhandlers.go
+++ b/worker/notmuch/eventhandlers.go
@@ -2,8 +2,21 @@ package notmuch
 
 func (w *worker) handleNotmuchEvent(et eventType) error {
 	switch ev := et.(type) {
+	case *updateDirCounts:
+		return w.handleUpdateDirCounts(ev)
 	default:
-		_ = ev
 		return errUnsupported
 	}
 }
+
+func (w *worker) handleUpdateDirCounts(ev eventType) error {
+	for name, query := range w.nameQueryMap {
+		info, err := w.gatherDirectoryInfo(name, query)
+		if err != nil {
+			w.w.Logger.Printf("could not gather DirectoryInfo: %v\n", err)
+			continue
+		}
+		w.w.PostMessage(info, nil)
+	}
+	return nil
+}