2021-12-11 22:20:53 +00:00
|
|
|
//go:build notmuch
|
|
|
|
// +build notmuch
|
2020-02-26 19:36:18 +00:00
|
|
|
|
2020-02-15 13:14:46 +00:00
|
|
|
package notmuch
|
|
|
|
|
2022-07-19 20:31:51 +00:00
|
|
|
import "git.sr.ht/~rjarry/aerc/logging"
|
|
|
|
|
2020-02-15 13:14:46 +00:00
|
|
|
func (w *worker) handleNotmuchEvent(et eventType) error {
|
|
|
|
switch ev := et.(type) {
|
2020-02-15 13:14:47 +00:00
|
|
|
case *updateDirCounts:
|
|
|
|
return w.handleUpdateDirCounts(ev)
|
2020-02-15 13:14:46 +00:00
|
|
|
default:
|
|
|
|
return errUnsupported
|
|
|
|
}
|
|
|
|
}
|
2020-02-15 13:14:47 +00:00
|
|
|
|
|
|
|
func (w *worker) handleUpdateDirCounts(ev eventType) error {
|
|
|
|
for name, query := range w.nameQueryMap {
|
2022-07-30 15:36:56 +00:00
|
|
|
info, err := w.buildDirInfo(name, query, true)
|
2020-02-15 13:14:47 +00:00
|
|
|
if err != nil {
|
2022-07-19 20:31:51 +00:00
|
|
|
logging.Errorf("could not gather DirectoryInfo: %v", err)
|
2020-02-15 13:14:47 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
w.w.PostMessage(info, nil)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|