aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-12-12 10:22:28 -0500
committerDrew DeVault <sir@cmpwn.com>2019-12-12 10:22:28 -0500
commit0ef4b6f9e2810e5316c71d27db230925b483732e (patch)
tree18c9166abb97a157029439e480b451384fbcdf82 /widgets
parentdfe58842b967e2951604b631b89dfd61117745ec (diff)
downloadaerc-0ef4b6f9e2810e5316c71d27db230925b483732e.tar.gz
Composer: fix EOF errors
PrepareHeaders generated a fresh message ID and Date header every time. This instead generates those headers in advance.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/compose.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index c6c8015a..242b6dba 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -35,12 +35,14 @@ type Composer struct {
config *config.AercConfig
aerc *Aerc
+ attachments []string
+ date time.Time
defaults map[string]string
editor *Terminal
email *os.File
- attachments []string
grid *ui.Grid
header *ui.Grid
+ msgId string
review *reviewMessage
worker *types.Worker
@@ -75,14 +77,16 @@ func NewComposer(aerc *Aerc, conf *config.AercConfig,
}
c := &Composer{
- aerc: aerc,
- editors: editors,
acct: acct,
+ aerc: aerc,
config: conf,
+ date: time.Now(),
defaults: defaults,
+ editors: editors,
email: email,
- worker: worker,
layout: layout,
+ msgId: mail.GenerateMessageID(),
+ worker: worker,
// You have to backtab to get to "From", since you usually don't edit it
focused: 1,
focusable: focusable,
@@ -409,7 +413,7 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
}
// Update headers
mhdr := (*message.Header)(&header.Header)
- mhdr.SetText("Message-Id", mail.GenerateMessageID())
+ mhdr.SetText("Message-Id", c.msgId)
headerKeys := make([]string, 0, len(c.editors))
for key := range c.editors {
@@ -437,7 +441,7 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
}
case "Date":
if date, err := header.Date(); err != nil || date == (time.Time{}) {
- header.SetDate(time.Now())
+ header.SetDate(c.date)
}
case "From", "To", "Cc", "Bcc": // Address headers
if val != "" {