diff options
author | Reto Brunner <reto@labrat.space> | 2020-08-19 12:01:45 +0200 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-08-20 19:18:57 +0200 |
commit | c84630714405a1e93766a6a6c023801302a3ea66 (patch) | |
tree | 156e9f45c6847a123f677594c8aff3a82322bce8 /widgets | |
parent | fe1cabb077cf6c6cb3de122b3f5532acbeba8c85 (diff) | |
download | aerc-c84630714405a1e93766a6a6c023801302a3ea66.tar.gz |
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.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/msgviewer.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 6a917413..587959b9 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -17,6 +17,7 @@ import ( "git.sr.ht/~sircmpwn/aerc/config" "git.sr.ht/~sircmpwn/aerc/lib" + "git.sr.ht/~sircmpwn/aerc/lib/format" "git.sr.ht/~sircmpwn/aerc/lib/ui" "git.sr.ht/~sircmpwn/aerc/models" ) @@ -130,13 +131,13 @@ func NewMessageViewer(acct *AccountView, func fmtHeader(msg *models.MessageInfo, header string, timefmt string) string { switch header { case "From": - return models.FormatAddresses(msg.Envelope.From) + return format.FormatAddresses(msg.Envelope.From) case "To": - return models.FormatAddresses(msg.Envelope.To) + return format.FormatAddresses(msg.Envelope.To) case "Cc": - return models.FormatAddresses(msg.Envelope.Cc) + return format.FormatAddresses(msg.Envelope.Cc) case "Bcc": - return models.FormatAddresses(msg.Envelope.Bcc) + return format.FormatAddresses(msg.Envelope.Bcc) case "Date": return msg.Envelope.Date.Local().Format(timefmt) case "Subject": @@ -496,11 +497,11 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig, case "subject": header = info.Envelope.Subject case "from": - header = models.FormatAddresses(info.Envelope.From) + header = format.FormatAddresses(info.Envelope.From) case "to": - header = models.FormatAddresses(info.Envelope.To) + header = format.FormatAddresses(info.Envelope.To) case "cc": - header = models.FormatAddresses(info.Envelope.Cc) + header = format.FormatAddresses(info.Envelope.Cc) } if f.Regex.Match([]byte(header)) { filter = exec.Command("sh", "-c", f.Command) |