diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-05-16 14:16:45 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-05-16 14:16:45 -0400 |
commit | ce0d0e887ccf386006a5f1a425d9aa971190c610 (patch) | |
tree | 04d043b7790e85670856d405d4eb0ef39f5924e0 /commands/account/reply.go | |
parent | 5701b6e94968e6e84dd0c197eaf1dd8eb757da7b (diff) | |
download | aerc-ce0d0e887ccf386006a5f1a425d9aa971190c610.tar.gz |
Improve reply-all recipient enumeration strategy
Diffstat (limited to 'commands/account/reply.go')
-rw-r--r-- | commands/account/reply.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/commands/account/reply.go b/commands/account/reply.go index 211af759..06f93f15 100644 --- a/commands/account/reply.go +++ b/commands/account/reply.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + gomail "net/mail" "strings" "github.com/emersion/go-message" @@ -42,6 +43,8 @@ func Reply(aerc *widgets.Aerc, args []string) error { } acct := aerc.SelectedAccount() + conf := acct.AccountConfig() + us, _ := gomail.ParseAddress(conf.From) store := acct.Messages().Store() msg := acct.Messages().Selected() acct.Logger().Println("Replying to email " + msg.Envelope.MessageId) @@ -75,6 +78,19 @@ func Reply(aerc *widgets.Aerc, args []string) error { addr.MailboxName, addr.HostName)) } } + for _, addr := range msg.Envelope.To { + address := fmt.Sprintf("%s@%s", addr.MailboxName, addr.HostName) + if address == us.Address { + continue + } + if addr.PersonalName != "" { + to = append(to, fmt.Sprintf("%s <%s@%s>", + addr.PersonalName, addr.MailboxName, addr.HostName)) + } else { + to = append(to, fmt.Sprintf("<%s@%s>", + addr.MailboxName, addr.HostName)) + } + } } var subject string |