blob: 745e6e6f7e6f18ab33ad01cdc1a7ab34f28429c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
require "vnd.dovecot.testsuite";
require "mime";
require "foreverypart";
require "editheader";
require "relational";
require "variables";
# Example from RFC 6047, Section 2.5:
test_set "message" text:
From: user1@example.com
To: user2@example.com
Subject: Phone Conference
Mime-Version: 1.0
Date: Wed, 07 May 2008 21:30:25 +0400
Message-ID: <4821E731.5040506@laptop1.example.com>
Content-Type: text/calendar; method=REQUEST; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
BEGIN:VCALENDAR
PRODID:-//Example/ExampleCalendarClient//EN
METHOD:REQUEST
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:mailto:user1@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:mailto:user1@example.com
ATTENDEE;RSVP=YES;CUTYPE=INDIVIDUAL:mailto:user2@example.com
DTSTAMP:20080507T170000Z
DTSTART:20080701T160000Z
DTEND:20080701T163000Z
SUMMARY:Phone call to discuss your last visit
DESCRIPTION:=D1=82=D1=8B =D0=BA=D0=B0=D0=BA - =D0=B4=D0=BE=D0=
=B2=D0=BE=D0=BB=D0=B5=D0=BD =D0=BF=D0=BE=D0=B5=D0=B7=D0=B4=D0=BA=D0
=BE=D0=B9?
UID:calsvr.example.com-8739701987387998
SEQUENCE:0
STATUS:TENTATIVE
END:VEVENT
END:VCALENDAR
.
;
test "Calendar only" {
foreverypart {
if allof(
header :mime :count "eq" "Content-Type" "1",
header :mime :contenttype "Content-Type" "text/calendar",
header :mime :param "method" :matches "Content-Type" "*",
header :mime :param "charset" :is "Content-Type" "UTF-8" ) {
addheader "X-ICAL" "${1}";
break;
}
}
if not header "x-ical" "request" {
test_fail "Failed to parse message correctly";
}
}
# Modified example
test_set "message" text:
From: user1@example.com
To: user2@example.com
Subject: Phone Conference
Mime-Version: 1.0
Date: Wed, 07 May 2008 21:30:25 +0400
Message-ID: <4821E731.5040506@laptop1.example.com>
Content-Type: multipart/mixed; boundary=AA
This is a multi-part message in MIME format.
--AA
Content-Type: text/plain
Hello,
I'd like to discuss your last visit. A tentative meeting schedule is
attached.
Regards,
User1
--AA
Content-Type: text/calendar; method=REQUEST; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
BEGIN:VCALENDAR
PRODID:-//Example/ExampleCalendarClient//EN
METHOD:REQUEST
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:mailto:user1@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:mailto:user1@example.com
ATTENDEE;RSVP=YES;CUTYPE=INDIVIDUAL:mailto:user2@example.com
DTSTAMP:20080507T170000Z
DTSTART:20080701T160000Z
DTEND:20080701T163000Z
SUMMARY:Phone call to discuss your last visit
DESCRIPTION:=D1=82=D1=8B =D0=BA=D0=B0=D0=BA - =D0=B4=D0=BE=D0=
=B2=D0=BE=D0=BB=D0=B5=D0=BD =D0=BF=D0=BE=D0=B5=D0=B7=D0=B4=D0=BA=D0
=BE=D0=B9?
UID:calsvr.example.com-8739701987387998
SEQUENCE:0
STATUS:TENTATIVE
END:VEVENT
END:VCALENDAR
--AA--
.
;
test "Multipart message" {
foreverypart {
if allof(
header :mime :count "eq" "Content-Type" "1",
header :mime :contenttype "Content-Type" "text/calendar",
header :mime :param "method" :matches "Content-Type" "*",
header :mime :param "charset" :is "Content-Type" "UTF-8" ) {
addheader "X-ICAL" "${1}";
break;
}
}
if not header "x-ical" "request" {
test_fail "Failed to parse message correctly";
}
}
|