2021-12-11 23:20:53 +01:00
|
|
|
//go:build notmuch
|
|
|
|
// +build notmuch
|
2020-02-26 20:36:18 +01:00
|
|
|
|
2020-02-15 14:14:46 +01:00
|
|
|
package notmuch
|
|
|
|
|
|
|
|
func (w *worker) handleNotmuchEvent(et eventType) error {
|
|
|
|
switch ev := et.(type) {
|
2020-02-15 14:14:47 +01:00
|
|
|
case *updateDirCounts:
|
|
|
|
return w.handleUpdateDirCounts(ev)
|
2020-02-15 14:14:46 +01:00
|
|
|
default:
|
|
|
|
return errUnsupported
|
|
|
|
}
|
|
|
|
}
|
2020-02-15 14:14:47 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|