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>
This commit is contained in:
parent
e4d418eed1
commit
d3b62dd3b0
6 changed files with 32 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue