diff options
author | Reto Brunner <reto@labrat.space> | 2020-01-04 21:13:51 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-01-05 16:02:45 -0500 |
commit | 9096049f757ca0a43ac5cbad7eb27db8c1897d91 (patch) | |
tree | a60080179514c9862b75a16deaf6dc7c82e65baf /commands/msg/forward.go | |
parent | 19dfc49481c6c8271115658c46ea68a1c977f1d0 (diff) | |
download | aerc-9096049f757ca0a43ac5cbad7eb27db8c1897d91.tar.gz |
FetchBodyParts: decode source in the workers
Previously the workers returned a mixture of decoded / encoded parts.
This lead to a whole bunch of issues.
This commit changes the msgviewer and the commands to assume parts to already
be decoded
Diffstat (limited to 'commands/msg/forward.go')
-rw-r--r-- | commands/msg/forward.go | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 75701772..35d276e6 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -10,9 +10,6 @@ import ( "path" "strings" - "github.com/emersion/go-message" - "github.com/emersion/go-message/mail" - "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" @@ -138,28 +135,9 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { // TODO: something more intelligent than fetching the 1st part // TODO: add attachments! - store.FetchBodyPart(msg.Uid, []int{1}, func(reader io.Reader) { - header := message.Header{} - header.SetText( - "Content-Transfer-Encoding", msg.BodyStructure.Encoding) - header.SetContentType( - msg.BodyStructure.MIMEType, msg.BodyStructure.Params) - header.SetText("Content-Description", msg.BodyStructure.Description) - entity, err := message.New(header, reader) - if err != nil { - // TODO: Do something with the error - addTab() - return - } - mreader := mail.NewReader(entity) - part, err := mreader.NextPart() - if err != nil { - // TODO: Do something with the error - addTab() - return - } + store.FetchBodyPart(msg.Uid, msg.BodyStructure, []int{1}, func(reader io.Reader) { buf := new(bytes.Buffer) - buf.ReadFrom(part.Body) + buf.ReadFrom(reader) defaults["Original"] = buf.String() addTab() }) |