summary refs log tree commit diff stats
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-14 13:07:48 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-14 13:07:48 -0400
commit6c36e04c1f7f7e222c71c5c8e7e7337744fe9c34 (patch)
tree52695aa088a565808275582f138cf673c0066d76 /widgets/msgviewer.go
parentd5e82ecfe05065a84f1e13bee44e309b8e1559bd (diff)
downloadaerc-6c36e04c1f7f7e222c71c5c8e7e7337744fe9c34.tar.gz
Add :send-message, prepares & writes email to /tmp
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index ba99911..3eda27d 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -10,6 +10,7 @@ import (
 	"github.com/danwakefield/fnmatch"
 	"github.com/emersion/go-imap"
 	"github.com/emersion/go-message"
+	_ "github.com/emersion/go-message/charset"
 	"github.com/emersion/go-message/mail"
 	"github.com/gdamore/tcell"
 	"github.com/google/shlex"
@@ -109,7 +110,8 @@ func NewMessageViewer(conf *config.AercConfig, store *lib.MessageStore,
 	pager = exec.Command(cmd[0], cmd[1:]...)
 
 	for _, f := range conf.Filters {
-		mime := strings.ToLower(msg.BodyStructure.MIMEType) + "/" + strings.ToLower(msg.BodyStructure.MIMESubType)
+		mime := strings.ToLower(msg.BodyStructure.MIMEType) +
+			"/" + strings.ToLower(msg.BodyStructure.MIMESubType)
 		switch f.FilterType {
 		case config.FILTER_MIMETYPE:
 			if fnmatch.Match(f.Filter, mime, 0) {
@@ -181,11 +183,12 @@ handle_error:
 
 func (mv *MessageViewer) attemptCopy() {
 	if mv.source != nil && mv.pager.Process != nil {
-		header := make(message.Header)
-		header.Set("Content-Transfer-Encoding", mv.msg.BodyStructure.Encoding)
+		header := message.Header{}
+		header.SetText("Content-Transfer-Encoding",
+			mv.msg.BodyStructure.Encoding)
 		header.SetContentType(
 			mv.msg.BodyStructure.MIMEType, mv.msg.BodyStructure.Params)
-		header.SetContentDescription(mv.msg.BodyStructure.Description)
+		header.SetText("Content-Description", mv.msg.BodyStructure.Description)
 		if mv.filter != nil {
 			stdout, _ := mv.filter.StdoutPipe()
 			mv.filter.Start()