models: add RFC822 headers to OriginalMail

This commit is contained in:
Reto Brunner 2020-11-03 07:39:36 +01:00
parent e7d450c61d
commit 3ad3a5ede0
3 changed files with 15 additions and 16 deletions

View file

@ -74,14 +74,13 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
"To": to, "To": to,
"Subject": subject, "Subject": subject,
} }
original := models.OriginalMail{} original := models.OriginalMail{
From: format.FormatAddresses(msg.Envelope.From),
Date: msg.Envelope.Date,
RFC822Headers: msg.RFC822Headers,
}
addTab := func() (*widgets.Composer, error) { addTab := func() (*widgets.Composer, error) {
if template != "" {
original.From = format.FormatAddresses(msg.Envelope.From)
original.Date = msg.Envelope.Date
}
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(), composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(),
acct.Worker(), template, defaults, original) acct.Worker(), template, defaults, original)
if err != nil { if err != nil {

View file

@ -152,14 +152,13 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
"Subject": subject, "Subject": subject,
"In-Reply-To": msg.Envelope.MessageId, "In-Reply-To": msg.Envelope.MessageId,
} }
original := models.OriginalMail{} original := models.OriginalMail{
From: format.FormatAddresses(msg.Envelope.From),
Date: msg.Envelope.Date,
RFC822Headers: msg.RFC822Headers,
}
addTab := func() error { addTab := func() error {
if template != "" {
original.From = format.FormatAddresses(msg.Envelope.From)
original.Date = msg.Envelope.Date
}
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), composer, err := widgets.NewComposer(aerc, acct, aerc.Config(),
acct.AccountConfig(), acct.Worker(), template, defaults, original) acct.AccountConfig(), acct.Worker(), template, defaults, original)
if err != nil { if err != nil {

View file

@ -134,8 +134,9 @@ type Envelope struct {
// OriginalMail is helper struct used for reply/forward // OriginalMail is helper struct used for reply/forward
type OriginalMail struct { type OriginalMail struct {
Date time.Time Date time.Time
From string From string
Text string Text string
MIMEType string MIMEType string
RFC822Headers *mail.Header
} }