diff options
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r-- | worker/notmuch/worker.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index c6a81050..f3a9ce8b 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -182,6 +182,8 @@ func (w *worker) handleMessage(msg types.WorkerMessage) error { return w.handleFlagMessages(msg) case *types.AnsweredMessages: return w.handleAnsweredMessages(msg) + case *types.ForwardedMessages: + return w.handleForwardedMessages(msg) case *types.SearchDirectory: return w.handleSearchDirectory(msg) case *types.ModifyLabels: @@ -545,6 +547,24 @@ func (w *worker) handleAnsweredMessages(msg *types.AnsweredMessages) error { return nil } +func (w *worker) handleForwardedMessages(msg *types.ForwardedMessages) error { + for _, uid := range msg.Uids { + m, err := w.msgFromUid(uid) + if err != nil { + w.w.Errorf("could not get message: %v", err) + w.err(msg, err) + continue + } + if err := m.MarkForwarded(msg.Forwarded); err != nil { + w.w.Errorf("could not mark message as forwarded: %v", err) + w.err(msg, err) + continue + } + } + w.done(msg) + return nil +} + func (w *worker) handleFlagMessages(msg *types.FlagMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) |