compose: use a proper header instead of a string map

Prior to this commit, the composer was based on a map[string]string.
While this approach was very versatile, it lead to a constant encoding / decoding
of addresses and other headers.

This commit switches to a different model, where the composer is based on a header.
Commands which want to interact with it can simply set some defaults they would
like to have. Users can overwrite them however they like.

In order to get access to the functions generating / getting the msgid go-message
was upgraded.
This commit is contained in:
Reto Brunner 2020-11-10 20:27:30 +01:00
parent 3ad3a5ede0
commit 20ec2c8eeb
14 changed files with 318 additions and 217 deletions
lib/format

View file

@ -61,6 +61,7 @@ func AddressForHumans(a *mail.Address) string {
var atom *regexp.Regexp = regexp.MustCompile("^[a-z0-9!#$%7'*+-/=?^_`{}|~ ]+$")
// FormatAddresses formats a list of addresses into a human readable string
func FormatAddresses(l []*mail.Address) string {
formatted := make([]string, len(l))
for i, a := range l {