aboutsummaryrefslogtreecommitdiffstats
path: root/lib/messageview.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-10-03 23:56:07 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-04 09:44:04 +0200
commitd3b62dd3b0fe6f5f1fb52e4fa9247cf9b27cbb3c (patch)
tree4bed5ce3176282ae72664b31bb1f33d75f76ba76 /lib/messageview.go
parente4d418eed15858d6dcae70e73b8a6c3e4439b5bc (diff)
downloadaerc-d3b62dd3b0fe6f5f1fb52e4fa9247cf9b27cbb3c.tar.gz
view: add peek flag and propagate
Add a peek flag -p to the view commands to open the message viewer without setting the "seen" flag. If the flag is set, it would ignore the "auto-mark-read" config. The SetSeen flag will be propagated in case the message viewer moves on to other messages, i.e. with the delete or archive commands. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/messageview.go')
-rw-r--r--lib/messageview.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/messageview.go b/lib/messageview.go
index d774f4f3..e4f9cbeb 100644
--- a/lib/messageview.go
+++ b/lib/messageview.go
@@ -29,6 +29,9 @@ type MessageView interface {
FetchBodyPart(part []int, cb func(io.Reader))
MessageDetails() *models.MessageDetails
+
+ // SeenFlagSet returns true if the "seen" flag has been set
+ SeenFlagSet() bool
}
func usePGP(info *models.BodyStructure) bool {
@@ -56,6 +59,7 @@ type MessageStoreView struct {
message []byte
details *models.MessageDetails
bodyStructure *models.BodyStructure
+ setSeen bool
}
func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool,
@@ -65,6 +69,7 @@ func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool,
msv := &MessageStoreView{
messageInfo, store,
nil, nil, messageInfo.BodyStructure,
+ setSeen,
}
if usePGP(messageInfo.BodyStructure) {
@@ -102,6 +107,10 @@ func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool,
}
}
+func (msv *MessageStoreView) SeenFlagSet() bool {
+ return msv.setSeen
+}
+
func (msv *MessageStoreView) MessageInfo() *models.MessageInfo {
return msv.messageInfo
}