aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
authorARaspiK <araspik@protonmail.com>2020-07-05 14:29:52 +0000
committerReto Brunner <reto@labrat.space>2020-07-08 09:13:03 +0200
commit0535f6333f2f5d13469fc315a65c53ff8a5e83f3 (patch)
treefa3adf96b16d4a0296c04b6a17f5433c03fbc8de /worker/notmuch/worker.go
parentfda3f43e7c5e5a175a01dd3e5b8637b1ecb30c51 (diff)
downloadaerc-0535f6333f2f5d13469fc315a65c53ff8a5e83f3.tar.gz
Add additional flagging functionality
More mail flags can now be set, unset, and toggled, not just the read/seen flag. This functionality is implemented with a new `:flag` and `:unflag` command, which are extensions to the matching `:read` and `:unread` commands, adding support for different flags. In fact, the `read`/`unread` commands are now recognized aliases to `flag`/`unflag`. The new commands are also well documented in aerc(1). The change mostly extends the previous read/unread setting functionality by adding a selection for the flag to change.
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 3fdd11d2..f14b7ff0 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -113,8 +113,8 @@ func (w *worker) handleMessage(msg types.WorkerMessage) error {
return w.handleFetchMessageBodyPart(msg)
case *types.FetchFullMessages:
return w.handleFetchFullMessages(msg)
- case *types.ReadMessages:
- return w.handleReadMessages(msg)
+ case *types.FlagMessages:
+ return w.handleFlagMessages(msg)
case *types.AnsweredMessages:
return w.handleAnsweredMessages(msg)
case *types.SearchDirectory:
@@ -392,7 +392,7 @@ func (w *worker) handleAnsweredMessages(msg *types.AnsweredMessages) error {
return nil
}
-func (w *worker) handleReadMessages(msg *types.ReadMessages) error {
+func (w *worker) handleFlagMessages(msg *types.FlagMessages) error {
for _, uid := range msg.Uids {
m, err := w.msgFromUid(uid)
if err != nil {
@@ -400,8 +400,8 @@ func (w *worker) handleReadMessages(msg *types.ReadMessages) error {
w.err(msg, err)
continue
}
- if err := m.MarkRead(msg.Read); err != nil {
- w.w.Logger.Printf("could not mark message as read: %v", err)
+ if err := m.SetOneFlag(msg.Flag, msg.Enable); err != nil {
+ w.w.Logger.Printf("could not set flag %v as %v for message: %v", msg.Flag, msg.Enable, err)
w.err(msg, err)
continue
}