unsubscribe: parse internationalized headers

Fix the parsing of internationalized headers (RFC 6532). Enable
unsubscribe to work with regular and encoded headers.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
Koni Marti 2022-02-18 00:34:24 +01:00 committed by Robin Jarry
parent 11a4d5b71c
commit 287df9defb
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error {
if !headers.Has("list-unsubscribe") {
return errors.New("No List-Unsubscribe header found")
}
methods := parseUnsubscribeMethods(headers.Get("list-unsubscribe"))
text, err := headers.Text("list-unsubscribe")
if err != nil {
return err
}
methods := parseUnsubscribeMethods(text)
aerc.Logger().Printf("found %d unsubscribe methods", len(methods))
for _, method := range methods {
aerc.Logger().Printf("trying to unsubscribe using %v", method)