about summary refs log tree commit diff stats
path: root/commands/msg/forward.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/msg/forward.go')
-rw-r--r--commands/msg/forward.go26
1 files changed, 2 insertions, 24 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index 7570177..35d276e 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()
 		})