base models.Address on the mail.Address type

This allows us to hook into the std libs implementation of parsing related stuff.
For this, we need to get rid of the distinction between a mailbox and a host
to just a single "address" field.

However this is already the common case. All but one users immediately
concatenated the mbox/domain to a single address.

So this in effects makes it simpler for most cases and we simply do the
transformation in the special case.
This commit is contained in:
Reto Brunner 2020-08-19 12:01:45 +02:00
parent fe1cabb077
commit c846307144
7 changed files with 67 additions and 62 deletions
commands/msg

View file

@ -11,6 +11,7 @@ import (
"strings"
"git.sr.ht/~sircmpwn/aerc/lib"
"git.sr.ht/~sircmpwn/aerc/lib/format"
"git.sr.ht/~sircmpwn/aerc/models"
"git.sr.ht/~sircmpwn/aerc/widgets"
"git.sr.ht/~sircmpwn/aerc/worker/types"
@ -77,7 +78,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
addTab := func() (*widgets.Composer, error) {
if template != "" {
original.From = models.FormatAddresses(msg.Envelope.From)
original.From = format.FormatAddresses(msg.Envelope.From)
original.Date = msg.Envelope.Date
}