about summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-11-10 19:57:09 +0100
committerReto Brunner <reto@labrat.space>2020-11-14 15:40:13 +0100
commitfc9ccc30008e564c1dea23b3bfe480ca5a10c070 (patch)
tree80acc77569557d73cbd073def0dabd6472653b5d /commands/msg
parentfb67d1f5a3f6fe875d74581aff59c79817a7b9f4 (diff)
downloadaerc-fc9ccc30008e564c1dea23b3bfe480ca5a10c070.tar.gz
remove models.Address in favor of go-message Address
We made a new type out of go-message/mail.Address without any real reason.
This suddenly made it necessary to convert from one to the other without actually
having any benefit whatsoever.
This commit gets rid of the additional type
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/reply.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index bde9194..8503979 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -13,6 +13,7 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/lib/format"
 	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
+	"github.com/emersion/go-message/mail"
 )
 
 type reply struct{}
@@ -97,8 +98,8 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 	}
 
 	var (
-		to []*models.Address
-		cc []*models.Address
+		to []*mail.Address
+		cc []*mail.Address
 	)
 
 	recSet := newAddrSet() // used for de-duping
@@ -117,7 +118,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 		// we add our from address, so that we don't self address ourselves
 		recSet.Add(from)
 
-		envTos := make([]*models.Address, 0, len(msg.Envelope.To))
+		envTos := make([]*mail.Address, 0, len(msg.Envelope.To))
 		for _, addr := range msg.Envelope.To {
 			if recSet.Contains(addr) {
 				continue
@@ -147,7 +148,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 	defaults := map[string]string{
 		"To":          format.FormatAddresses(to),
 		"Cc":          format.FormatAddresses(cc),
-		"From":        from.Format(),
+		"From":        format.AddressForHumans(from),
 		"Subject":     subject,
 		"In-Reply-To": msg.Envelope.MessageId,
 	}
@@ -231,17 +232,17 @@ func newAddrSet() addrSet {
 	return addrSet(s)
 }
 
-func (s addrSet) Add(a *models.Address) {
+func (s addrSet) Add(a *mail.Address) {
 	s[a.Address] = struct{}{}
 }
 
-func (s addrSet) AddList(al []*models.Address) {
+func (s addrSet) AddList(al []*mail.Address) {
 	for _, a := range al {
 		s[a.Address] = struct{}{}
 	}
 }
 
-func (s addrSet) Contains(a *models.Address) bool {
+func (s addrSet) Contains(a *mail.Address) bool {
 	_, ok := s[a.Address]
 	return ok
 }