about summary refs log tree commit diff stats
path: root/lib
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 /lib
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 'lib')
-rw-r--r--lib/messageview.go2
-rw-r--r--lib/msgstore.go9
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/messageview.go b/lib/messageview.go
index 384a947..08ea92f 100644
--- a/lib/messageview.go
+++ b/lib/messageview.go
@@ -94,7 +94,7 @@ func NewMessageStoreView(messageInfo *models.MessageInfo,
 	} else {
 		cb(msv, nil)
 	}
-	store.Read([]uint32{messageInfo.Uid}, true, nil)
+	store.Flag([]uint32{messageInfo.Uid}, models.SeenFlag, true, nil)
 }
 
 func (msv *MessageStoreView) MessageInfo() *models.MessageInfo {
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 86215a7..dda15d3 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -333,11 +333,12 @@ func (store *MessageStore) Move(uids []uint32, dest string, createDest bool,
 	store.update()
 }
 
-func (store *MessageStore) Read(uids []uint32, read bool,
-	cb func(msg types.WorkerMessage)) {
+func (store *MessageStore) Flag(uids []uint32, flag models.Flag,
+	enable bool, cb func(msg types.WorkerMessage)) {
 
-	store.worker.PostAction(&types.ReadMessages{
-		Read: read,
+	store.worker.PostAction(&types.FlagMessages{
+		Enable: enable,
+		Flag: flag,
 		Uids: uids,
 	}, cb)
 }