From 20ec2c8eeb2e071f28358814935a0f56672a9f49 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Tue, 10 Nov 2020 20:27:30 +0100 Subject: 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. --- commands/compose/header.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'commands/compose/header.go') diff --git a/commands/compose/header.go b/commands/compose/header.go index 5188a8a2..dd0adee9 100644 --- a/commands/compose/header.go +++ b/commands/compose/header.go @@ -57,18 +57,17 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error { composer, _ := aerc.SelectedTab().(*widgets.Composer) if !force { - headers, _, err := composer.PrepareHeader() + headers, err := composer.PrepareHeader() if err != nil { return err } - if headers.Has(strings.Title(args[optind])) { + if headers.Has(args[optind]) { return fmt.Errorf("Header %s already exists", args[optind]) } } - composer.AddEditor(strings.Title(args[optind]), - strings.Join(args[optind+1:], " "), false) + composer.AddEditor(args[optind], strings.Join(args[optind+1:], " "), false) return nil } -- cgit