Improve reply-all recipient enumeration strategy
This commit is contained in:
parent
5701b6e949
commit
ce0d0e887c
1 changed files with 16 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
gomail "net/mail"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
|
@ -42,6 +43,8 @@ func Reply(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
acct := aerc.SelectedAccount()
|
acct := aerc.SelectedAccount()
|
||||||
|
conf := acct.AccountConfig()
|
||||||
|
us, _ := gomail.ParseAddress(conf.From)
|
||||||
store := acct.Messages().Store()
|
store := acct.Messages().Store()
|
||||||
msg := acct.Messages().Selected()
|
msg := acct.Messages().Selected()
|
||||||
acct.Logger().Println("Replying to email " + msg.Envelope.MessageId)
|
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))
|
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
|
var subject string
|
||||||
|
|
Loading…
Reference in a new issue