fix parsing List-Post header in webmail

This commit is contained in:
Mechiel Lukkien
2023-09-11 11:55:28 +02:00
parent f6d03a0eab
commit fc7b0cc71e
2 changed files with 25 additions and 4 deletions

21
webmail/message_test.go Normal file
View File

@ -0,0 +1,21 @@
package webmail
import (
"testing"
"github.com/mjl-/mox/dns"
)
func TestParseListPostAddress(t *testing.T) {
check := func(s string, exp *MessageAddress) {
t.Helper()
v := parseListPostAddress(s)
tcompare(t, v, exp)
}
check("<mailto:list@host.com>", &MessageAddress{User: "list", Domain: dns.Domain{ASCII: "host.com"}})
check("<mailto:moderator@host.com> (Postings are Moderated)", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}})
check("<mailto:moderator@host.com?subject=list%20posting>", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}})
check("NO (posting not allowed on this list)", nil)
check("", nil)
}