From e4d418eed15858d6dcae70e73b8a6c3e4439b5bc Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Mon, 3 Oct 2022 23:56:06 +0200 Subject: viewer: option to not mark message as seen Add option to open a message in the message viewer without setting the seen flag. Enables the message viewer to be used as a preview pane without changing the message flags unintentionally. Before, the message viewer would set the seen flag by default. The IMAP backend will now always fetch the message body with the peek option enabled (same as we fetch the headers). An "auto-mark-read" option is added to the ui config which is set to true by default. If set the false, the seen flag is not set by the message viewer. Co-authored-by: "James Cook" Signed-off-by: Koni Marti Acked-by: Robin Jarry --- lib/messageview.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/messageview.go') diff --git a/lib/messageview.go b/lib/messageview.go index ff754a43..d774f4f3 100644 --- a/lib/messageview.go +++ b/lib/messageview.go @@ -58,7 +58,7 @@ type MessageStoreView struct { bodyStructure *models.BodyStructure } -func NewMessageStoreView(messageInfo *models.MessageInfo, +func NewMessageStoreView(messageInfo *models.MessageInfo, setSeen bool, store *MessageStore, pgp crypto.Provider, decryptKeys openpgp.PromptFunction, cb func(MessageView, error), ) { @@ -97,7 +97,9 @@ func NewMessageStoreView(messageInfo *models.MessageInfo, } else { cb(msv, nil) } - store.Flag([]uint32{messageInfo.Uid}, models.SeenFlag, true, nil) + if setSeen { + store.Flag([]uint32{messageInfo.Uid}, models.SeenFlag, true, nil) + } } func (msv *MessageStoreView) MessageInfo() *models.MessageInfo { -- cgit