aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-12-21 16:21:26 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-21 11:20:11 -0500
commit40ceee969bd29508c1da28052c95eb85a52650ba (patch)
tree0224774c182196a7352496c7f461136285de0471 /worker/notmuch/worker.go
parent2705d8460d7e974ee01ad41ce063ae3feeb30317 (diff)
downloadaerc-40ceee969bd29508c1da28052c95eb85a52650ba.tar.gz
notmuch: emit LabelList event
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index ef4d4bfb..96ec0cb5 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -153,6 +153,7 @@ func (w *worker) handleConnect(msg *types.Connect) error {
return err
}
w.done(msg)
+ w.emitLabelList()
return nil
}
@@ -383,6 +384,8 @@ func (w *worker) handleModifyLabels(msg *types.ModifyLabels) error {
if err != nil {
return err
}
+ // and update the list of possible tags
+ w.emitLabelList()
w.done(msg)
return nil
}
@@ -460,6 +463,15 @@ func (w *worker) emitMessageInfo(m *Message,
return nil
}
+func (w *worker) emitLabelList() {
+ tags, err := w.db.ListTags()
+ if err != nil {
+ w.w.Logger.Printf("could not load tags: %v", err)
+ return
+ }
+ w.w.PostMessage(&types.LabelList{Labels: tags}, nil)
+}
+
func (w *worker) sort(uids []uint32,
criteria []*types.SortCriterion) ([]uint32, error) {
if len(criteria) == 0 {