store.FetchFull: Change callback type to expose entire message

This is a prerequisite for allowing the FetchFull message to return both
the message content and the message headers.
This commit is contained in:
Ben Fiedler 2020-04-24 22:31:39 +02:00 committed by Drew DeVault
parent b650bb30a2
commit 05fa79eb8e
5 changed files with 17 additions and 11 deletions

View file

@ -12,6 +12,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/models"
"git.sr.ht/~sircmpwn/aerc/worker/lib"
"git.sr.ht/~sircmpwn/aerc/worker/types"
)
// This is an abstraction for viewing a message with semi-transparent PGP
@ -65,7 +66,8 @@ func NewMessageStoreView(messageInfo *models.MessageInfo,
nil, nil, messageInfo.BodyStructure}
if usePGP(messageInfo.BodyStructure) {
store.FetchFull([]uint32{messageInfo.Uid}, func(reader io.Reader) {
store.FetchFull([]uint32{messageInfo.Uid}, func(fm *types.FullMessage) {
reader := fm.Content.Reader
pgpReader, err := pgpmail.Read(reader, Keyring, decryptKeys, nil)
if err != nil {
panic(err)