From 37e245539bc9e27db35731e7b517cdde397834e2 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 5 Dec 2020 00:19:16 +0530 Subject: email: Support obsolete addressing. * email/email.scm (obs-qp, obs-fws, obs-no-ws-ctl, obs-ctext, obs-qtext, obs-phrase, obs-local-part, obs-dtext, obs-domain, obs-domain-list, obs-route, obs-angle-addr, captured-atom, captured-obs-domain, captured-domain, obs-mbox-list, obs-group-list, obs-addr-list, obs-id-left, obs-id-right): New patterns. (quoted-pair, fws, ctext, qtext, phrase, dtext, define-angle-addr-pattern, mailbox-list, group-list, address-list, define-field-pattern, from, sender, bcc, id-left, id-right, resent-from, resent-sender, resent-bcc, obs-resent-rply): Include obsolete pattern. (define-printable-ascii-character-pattern-with-obsolete, define-atom-pattern, define-obs-domain-pattern): New macros. (define-domain-pattern): Accept obs-domain as a new argument. (fields): Include obs-resent-rply. * tests/email.scm ("RFC5322 A.6.1. Obsolete addressing"): New test. ("parse email addresses with period in name"): Mark as passing. --- tests/email.scm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/email.scm b/tests/email.scm index a2b6361..8a7be9b 100644 --- a/tests/email.scm +++ b/tests/email.scm @@ -190,6 +190,31 @@ Hi everyone.") (message-id . "5678.21-Nov-1997@example.com")) "Hi everyone.")) +(test-email= "RFC5322 A.6.1. Obsolete addressing" + (parse-email + (string->bytevector + "From: Joe Q. Public +To: Mary Smith <@node.test:mary@example.net>, , jdoe@test . example +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Message-ID: <5678.21-Nov-1997@example.com> + +Hi everyone. +" + "utf-8")) + (make-email + `((from ((name . "Joe Q. Public") + (address . "john.q.public@example.com"))) + (to ((name . "Mary Smith") + (address . "mary@example.net")) + ((address . "jdoe@test . example"))) + (date . ,(make-date 0 37 52 10 1 7 2003 7200)) + (message-id . "5678.21-Nov-1997@example.com") + (content-type (type . text) + (subtype . plain) + (charset . "utf-8")) + (content-transfer-encoding . 7bit)) + "Hi everyone.")) + (test-email= "RFC2046 5.1.1. Common syntax" (parse-email (string->bytevector @@ -410,8 +435,6 @@ copyright =A9") (parse-email-address "foo@example.org (Foo)") '((name . "Foo") (address . "foo@example.org"))) -(test-expect-fail "parse email addresses with period in name") - (test-equal "parse email addresses with period in name" (parse-email-address "Foo P. Bar ") '((name . "Foo P. Bar") (address . "foo@example.com"))) -- cgit v1.2.3