diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/account/compose.go | 4 | ||||
-rw-r--r-- | commands/msg/forward.go | 10 | ||||
-rw-r--r-- | commands/msg/reply.go | 9 | ||||
-rw-r--r-- | commands/msg/unsubscribe.go | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/commands/account/compose.go b/commands/account/compose.go index 24e460b3..c2144418 100644 --- a/commands/account/compose.go +++ b/commands/account/compose.go @@ -5,6 +5,7 @@ import ( "regexp" "strings" + "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" ) @@ -31,7 +32,8 @@ func (Compose) Execute(aerc *widgets.Aerc, args []string) error { acct := aerc.SelectedAccount() composer, err := widgets.NewComposer(aerc, - aerc.Config(), acct.AccountConfig(), acct.Worker(), template, nil) + aerc.Config(), acct.AccountConfig(), acct.Worker(), + template, nil, models.OriginalMail{}) if err != nil { return err } diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 35d276e6..c51949ed 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -71,14 +71,16 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { "Subject": subject, } + original := models.OriginalMail{} + addTab := func() (*widgets.Composer, error) { if template != "" { - defaults["OriginalFrom"] = models.FormatAddresses(msg.Envelope.From) - defaults["OriginalDate"] = msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM") + original.From = models.FormatAddresses(msg.Envelope.From) + original.Date = msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM") } composer, err := widgets.NewComposer(aerc, aerc.Config(), acct.AccountConfig(), - acct.Worker(), template, defaults) + acct.Worker(), template, defaults, original) if err != nil { aerc.PushError("Error: " + err.Error()) return nil, err @@ -138,7 +140,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { store.FetchBodyPart(msg.Uid, msg.BodyStructure, []int{1}, func(reader io.Reader) { buf := new(bytes.Buffer) buf.ReadFrom(reader) - defaults["Original"] = buf.String() + original.Text = buf.String() addTab() }) } diff --git a/commands/msg/reply.go b/commands/msg/reply.go index a7379d75..2964a83e 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -116,15 +116,16 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { "Subject": subject, "In-Reply-To": msg.Envelope.MessageId, } + original := models.OriginalMail{} addTab := func() error { if template != "" { - defaults["OriginalFrom"] = models.FormatAddresses(msg.Envelope.From) - defaults["OriginalDate"] = msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM") + original.From = models.FormatAddresses(msg.Envelope.From) + original.Date = msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM") } composer, err := widgets.NewComposer(aerc, aerc.Config(), - acct.AccountConfig(), acct.Worker(), template, defaults) + acct.AccountConfig(), acct.Worker(), template, defaults, original) if err != nil { aerc.PushError("Error: " + err.Error()) return err @@ -155,7 +156,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { store.FetchBodyPart(msg.Uid, msg.BodyStructure, []int{1}, func(reader io.Reader) { buf := new(bytes.Buffer) buf.ReadFrom(reader) - defaults["Original"] = buf.String() + original.Text = buf.String() addTab() }) return nil diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 5ffec465..682b2b58 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -7,6 +7,7 @@ import ( "strings" "git.sr.ht/~sircmpwn/aerc/lib" + "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" ) @@ -94,6 +95,7 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL) error { acct.Worker(), "", defaults, + models.OriginalMail{}, ) if err != nil { return err |