Commit c401f4d6 c401f4d6ec058a57bb75b6a3664c7726f876d1dc by Sergey Poznyakoff

Added to the repository

1 parent 365371c6
1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, Free Software Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 # 6.4.5. FETCH Command
20 # Arguments: message set
21 # message data item names
22 # Responses: untagged responses: FETCH
23 # Result: OK - fetch completed
24 # NO - fetch error: can't fetch that data
25 # BAD - command unknown or arguments invalid
26 #
27 # The FETCH command retrieves data associated with a message in the
28 # mailbox. The data items to be fetched can be either a single atom
29 # or a parenthesized list.
30
31 imap4d_start
32 imap4d_auth "user!passwd" "guessme"
33
34 imap4d_test "SELECT mbox1" \
35 "4 EXISTS"\
36 "4 RECENT"\
37 -re "OK \\\[UIDVALIDITY [imap4d_uidvalidity]\\\] UID valididy status"\
38 "OK \[UIDNEXT 5\] Predicted next uid"\
39 "OK \[UNSEEN 1\] first unseen messsage"\
40 "FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)"\
41 "OK \[PERMANENTFLAGS (\\Answered \\Deleted \\Seen)\] Permanent flags" \
42 "OK"
43
44 # FLAGS The flags that are set for this message.
45 imap4d_test "FETCH 3 (FLAGS)"\
46 "3 FETCH (FLAGS (\\Recent))"\
47 "OK"
48
49 # INTERNALDATE The internal date of the message.
50 imap4d_test "FETCH 3 INTERNALDATE"\
51 "3 FETCH (INTERNALDATE \"13-Jul-2002 00:43:18 +0000\")"\
52 "OK"
53
54 # UID The unique identifier for the message.
55 imap4d_test "FETCH 3 UID"\
56 "3 FETCH (UID 3)"\
57 "OK"
58
59 imap4d_test "FETCH 3 (FLAGS INTERNALDATE UID)"\
60 "3 FETCH (FLAGS (\\Recent) INTERNALDATE \"13-Jul-2002 00:43:18 +0000\" UID 3)"\
61 "OK"
62
63 # ENVELOPE The envelope structure of the message. This is
64 # computed by the server by parsing the [RFC-822]
65 # header into the component parts, defaulting various
66 # fields as necessary.
67
68 imap4d_test "FETCH 1:* ENVELOPE"\
69 "1 FETCH (ENVELOPE (\"Fri, 28 Dec 2001 22:18:08 +0200\" \"Jabberwocky\"((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200112282018.fBSKI8N04906@nonexistent.net>\"))"\
70 "2 FETCH (ENVELOPE (\"Fri, 28 Dec 2001 23:28:08 +0200\" \"Re: Jabberwocky\"((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200112232808.fERKR9N16790@dontmailme.org>\"))"\
71 "3 FETCH (ENVELOPE (\"Sat, 13 Jul 2002 00:43:18 +0300\" \"Simple MIME\"((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200207122143.g6CLhIb05086@Mirddin.farlep.net>\"))"\
72 "4 FETCH (ENVELOPE (\"Sat, 13 Jul 2002 00:50:58 +0300\" \"Nested MIME\"((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200207122150.g6CLowb05126@Mirddin.farlep.net>\"))"\
73 "OK"
74
75 # ALL Macro equivalent to: (FLAGS INTERNALDATE
76 # RFC822.SIZE ENVELOPE)
77
78 imap4d_test "FETCH 1:\* ALL"\
79 "1 FETCH (FLAGS (\\Recent) INTERNALDATE \"28-Dec-2001 23:18:09 +0000\" RFC822.SIZE 1299 ENVELOPE (\"Fri, 28 Dec 2001 22:18:08 +0200\" \"Jabberwocky\"((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200112282018.fBSKI8N04906@nonexistent.net>\"))"\
80 "2 FETCH (FLAGS (\\Recent) INTERNALDATE \"29-Dec-2001 00:28:09 +0000\" RFC822.SIZE 548 ENVELOPE (\"Fri, 28 Dec 2001 23:28:08 +0200\" \"Re: Jabberwocky\"((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Bar\" NIL \"bar\" \"dontmailme.org\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200112232808.fERKR9N16790@dontmailme.org>\"))"\
81 "3 FETCH (FLAGS (\\Recent) INTERNALDATE \"13-Jul-2002 00:43:18 +0000\" RFC822.SIZE 1668 ENVELOPE (\"Sat, 13 Jul 2002 00:43:18 +0300\" \"Simple MIME\"((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200207122143.g6CLhIb05086@Mirddin.farlep.net>\"))"\
82 "4 FETCH (FLAGS (\\Recent) INTERNALDATE \"13-Jul-2002 00:50:58 +0000\" RFC822.SIZE 3568 ENVELOPE (\"Sat, 13 Jul 2002 00:50:58 +0300\" \"Nested MIME\"((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200207122150.g6CLowb05126@Mirddin.farlep.net>\"))"\
83 "OK"
84
85 # BODYSTRUCTURE The [MIME-IMB] body structure of the message. This
86 # is computed by the server by parsing the [MIME-IMB]
87 # header fields in the [RFC-822] header and
88 # [MIME-IMB] headers.
89
90 imap4d_test "FETCH 1 BODYSTRUCTURE"\
91 "1 FETCH (BODYSTRUCTURE (TEXT PLAIN (\"CHARSET\" \"US-ASCII\") NIL NIL 7BIT 972 35 NIL NIL NIL))"\
92 "OK"
93
94 imap4d_test "FETCH 2 BODYSTRUCTURE"\
95 "2 FETCH (BODYSTRUCTURE (TEXT PLAIN (\"CHARSET\" \"US-ASCII\") NIL NIL 7BIT 219 4 NIL NIL NIL))"\
96 "OK"
97
98 imap4d_test "FETCH 3 BODYSTRUCTURE"\
99 "3 FETCH (BODYSTRUCTURE ((\"text\" \"plain\" (\"name\" \"msg.1\" \"charset\" \"us-ascii\") \"<5082.1026510189.1@Mirddin.farlep.net>\" \"How doth\" 7BIT 241 10 NIL NIL NIL)(\"application\" \"octet-stream\" (\"name\" \"msg.21\") \"<5082.1026510189.2@Mirddin.farlep.net>\" \"Father William Part I\" \"base64\" 470 NIL NIL NIL) \"mixed\" (\"boundary\" \"----- =_aaaaaaaaaa0\") NIL NIL))"\
100 "OK"
101
102 imap4d_test "FETCH 4 BODYSTRUCTURE"\
103 "4 FETCH (BODYSTRUCTURE ((\"text\" \"plain\" (\"name\" \"msg.21\" \"charset\" \"us-ascii\") \"<5122.1026510654.2@Mirddin.farlep.net>\" \"Father William Part I\" 7BIT 353 11 NIL NIL NIL)((\"application\" \"octet-stream\" (\"name\" \"msg.22\") \"<5122.1026510654.4@Mirddin.farlep.net>\" \"Father William Part II\" \"base64\" 488 NIL NIL NIL)((\"application\" \"octet-stream\" (\"name\" \"msg.23\") \"<5122.1026510654.6@Mirddin.farlep.net>\" \"Father William Part III\" \"base64\" 492 NIL NIL NIL)(\"application\" \"octet-stream\" (\"name\" \"msg.24\") \"<5122.1026510654.7@Mirddin.farlep.net>\" \"Father William Part IV\" \"base64\" 504 NIL NIL NIL) \"mixed\" (\"boundary\" \"----- =_aaaaaaaaaa2\") NIL NIL) \"mixed\" (\"boundary\" \"----- =_aaaaaaaaaa1\") NIL NIL) \"mixed\" (\"boundary\" \"----- =_aaaaaaaaaa0\") NIL NIL))"\
104 "OK"
105
106 # BODY The text of a particular body section.
107 imap4d_test "FETCH 1:* BODY"\
108 "1 FETCH (BODY (TEXT PLAIN (\"CHARSET\" \"US-ASCII\") NIL NIL 7BIT 972 35))"\
109 "2 FETCH (BODY (TEXT PLAIN (\"CHARSET\" \"US-ASCII\") NIL NIL 7BIT 219 4))"\
110 "3 FETCH (BODY ((\"text\" \"plain\" (\"name\" \"msg.1\" \"charset\" \"us-ascii\") \"<5082.1026510189.1@Mirddin.farlep.net>\" \"How doth\" 7BIT 241 10)(\"application\" \"octet-stream\" (\"name\" \"msg.21\") \"<5082.1026510189.2@Mirddin.farlep.net>\" \"Father William Part I\" \"base64\" 470) \"mixed\" NIL NIL NIL))"\
111 "4 FETCH (BODY ((\"text\" \"plain\" (\"name\" \"msg.21\" \"charset\" \"us-ascii\") \"<5122.1026510654.2@Mirddin.farlep.net>\" \"Father William Part I\" 7BIT 353 11)((\"application\" \"octet-stream\" (\"name\" \"msg.22\") \"<5122.1026510654.4@Mirddin.farlep.net>\" \"Father William Part II\" \"base64\" 488)((\"application\" \"octet-stream\" (\"name\" \"msg.23\") \"<5122.1026510654.6@Mirddin.farlep.net>\" \"Father William Part III\" \"base64\" 492)(\"application\" \"octet-stream\" (\"name\" \"msg.24\") \"<5122.1026510654.7@Mirddin.farlep.net>\" \"Father William Part IV\" \"base64\" 504) \"mixed\" NIL NIL NIL) \"mixed\" NIL NIL NIL) \"mixed\" NIL NIL NIL))"\
112 "OK"
113
114 # BODY.PEEK[<section>]<<partial>>
115 # An alternate form of BODY[<section>] that does not
116 # implicitly set the \Seen flag.
117
118 imap4d_test "FETCH 1 BODY.PEEK\[HEADER\]"\
119 "1 FETCH (BODY\[HEADER\] {327}"\
120 -literal\
121 "Received: (from foobar@nonexistent.net) "\
122 " by nonexistent.net id fBSKI8N04906"\
123 " for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
124 "Date: Fri, 28 Dec 2001 22:18:08 +0200"\
125 "From: Foo Bar <foobar@nonexistent.net>"\
126 "Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
127 "To: Bar <bar@dontmailme.org>"\
128 "Subject: Jabberwocky"\
129 ""\
130 ")"\
131 "OK"
132
133 # The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT
134 # part specifiers refer to the [RFC-822] header of
135 # the message or of an encapsulated [MIME-IMT]
136 # MESSAGE/RFC822 message.
137
138 imap4d_test "FETCH 1 BODY\[HEADER\]"\
139 "1 FETCH (FLAGS (\\Seen) BODY\[HEADER\] {327}"\
140 -literal\
141 "Received: (from foobar@nonexistent.net) "\
142 " by nonexistent.net id fBSKI8N04906"\
143 " for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
144 "Date: Fri, 28 Dec 2001 22:18:08 +0200"\
145 "From: Foo Bar <foobar@nonexistent.net>"\
146 "Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
147 "To: Bar <bar@dontmailme.org>"\
148 "Subject: Jabberwocky"\
149 ""\
150 ")"\
151 "OK"
152
153 # HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a list of
154 # field-name (as defined in [RFC-822]) names, and return a subset
155 # of the header.
156
157 # The subset returned by HEADER.FIELDS contains only those header fields
158 # with a field-name that matches one of the names in the list;
159
160 imap4d_test "FETCH 1 BODY\[HEADER.FIELDS FROM TO SUBJECT\]"\
161 "1 FETCH (BODY\[HEADER.FIELDS (\"FROM\" \"TO\" \"SUBJECT\")\] {94}"\
162 -literal\
163 "FROM: Foo Bar <foobar@nonexistent.net>"\
164 "TO: Bar <bar@dontmailme.org>"\
165 "SUBJECT: Jabberwocky"\
166 ""\
167 ")"\
168 "OK"
169
170 # similarly, the subset returned by HEADER.FIELDS.NOT contains only
171 # the header fields with a non-matching field-name.
172
173 imap4d_test "FETCH 1 BODY\[HEADER.FIELDS.NOT FROM TO SUBJECT\]"\
174 "1 FETCH (BODY\[HEADER.FIELDS.NOT (\"FROM\" \"TO\" \"SUBJECT\")\] {235}"\
175 -literal\
176 "Received: (from foobar@nonexistent.net) "\
177 " by nonexistent.net id fBSKI8N04906"\
178 " for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
179 "Date: Fri, 28 Dec 2001 22:18:08 +0200"\
180 "Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
181 ""\
182 ")"\
183 "OK"
184
185 # The TEXT part specifier refers to the text body of
186 # the message, omitting the [RFC-822] header.
187
188 imap4d_test "FETCH 1 BODY\[TEXT\]"\
189 "1 FETCH (BODY\[TEXT\] {972}"\
190 -literal\
191 "`Twas brillig, and the slithy toves"\
192 "Did gyre and gimble in the wabe;"\
193 "All mimsy were the borogoves,"\
194 "And the mome raths outgrabe."\
195 ""\
196 "`Beware the Jabberwock, my son!"\
197 "The jaws that bite, the claws that catch!"\
198 "Beware the Jujub bird, and shun"\
199 "The frumious Bandersnatch!'"\
200 ""\
201 "He took his vorpal sword in hand:"\
202 "Long time the manxome foe he sought --"\
203 "So rested he by the Tumtum gree,"\
204 "And stood awhile in thought."\
205 ""\
206 "And as in uffish thought he stood,"\
207 "The Jabberwock, with eyes of flame,"\
208 "Came whiffling through the tulgey wook,"\
209 "And burbled as it came!"\
210 ""\
211 "One, two! One, two! And through and through"\
212 "The vorpal blade went snicker-snack!"\
213 "He left it dead, and with its head"\
214 "He went galumphing back."\
215 ""\
216 "`And has thou slain the Jabberwock?"\
217 "Come to my arms, my beamish boy!"\
218 "O frabjous day! Calloh! Callay!"\
219 "He chortled in his joy."\
220 ""\
221 "`Twas brillig, and the slithy toves"\
222 "Did gyre and gimble in the wabe;"\
223 "All mimsy were the borogoves,"\
224 "And the mome raths outgrabe."\
225 ""\
226 ")"\
227 "OK"
228
229 # It is possible to fetch a substring of the
230 # designated text. This is done by appending an open
231 # angle bracket ("<"), the octet position of the
232 # first desired octet, a period, the maximum number
233 # of octets desired, and a close angle bracket (">")
234 # to the part specifier.
235 imap4d_test "FETCH 1 BODY\[TEXT\]<0.20>"\
236 "1 FETCH (BODY\[TEXT\]<0> {20}"\
237 -literal\
238 "`Twas brillig, and t)"\
239 "OK"
240
241 imap4d_test "FETCH 1 BODY\[TEXT\]<200.100>"\
242 "1 FETCH (BODY\[TEXT\]<200> {100}"\
243 -literal\
244 "t catch!"\
245 "Beware the Jujub bird, and shun"\
246 "The frumious Bandersnatch!'"\
247 ""\
248 "He took his vorpal sword i)"\
249 "OK"
250
251 # If the starting octet is beyond the end of
252 # the text, an empty string is returned.
253 imap4d_test "FETCH 1 BODY\[TEXT\]<3900.4000>"\
254 "1 FETCH (BODY\[TEXT\]<3900> \"\")"\
255 "OK"
256
257
258 # Any partial fetch that attempts to read beyond the
259 # end of the text is truncated as appropriate. A
260 # partial fetch that starts at octet 0 is returned as
261 # a partial fetch, even if this truncation happened.
262 #
263 # Note: this means that BODY[]<0.2048> of a 1500-octet
264 # message will return BODY[]<0> with a literal of size 1500,
265 # not BODY[].
266
267 imap4d_test "FETCH 1 BODY\[TEXT\]<0.4000>"\
268 "1 FETCH (BODY\[TEXT\]<0> {972}"\
269 -literal\
270 "`Twas brillig, and the slithy toves"\
271 "Did gyre and gimble in the wabe;"\
272 "All mimsy were the borogoves,"\
273 "And the mome raths outgrabe."\
274 ""\
275 "`Beware the Jabberwock, my son!"\
276 "The jaws that bite, the claws that catch!"\
277 "Beware the Jujub bird, and shun"\
278 "The frumious Bandersnatch!'"\
279 ""\
280 "He took his vorpal sword in hand:"\
281 "Long time the manxome foe he sought --"\
282 "So rested he by the Tumtum gree,"\
283 "And stood awhile in thought."\
284 ""\
285 "And as in uffish thought he stood,"\
286 "The Jabberwock, with eyes of flame,"\
287 "Came whiffling through the tulgey wook,"\
288 "And burbled as it came!"\
289 ""\
290 "One, two! One, two! And through and through"\
291 "The vorpal blade went snicker-snack!"\
292 "He left it dead, and with its head"\
293 "He went galumphing back."\
294 ""\
295 "`And has thou slain the Jabberwock?"\
296 "Come to my arms, my beamish boy!"\
297 "O frabjous day! Calloh! Callay!"\
298 "He chortled in his joy."\
299 ""\
300 "`Twas brillig, and the slithy toves"\
301 "Did gyre and gimble in the wabe;"\
302 "All mimsy were the borogoves,"\
303 "And the mome raths outgrabe."\
304 ""\
305 ")"\
306 "OK"
307
308 # The MIME part specifier refers to the [MIME-IMB]
309 # header for this part.
310
311 # The MIME part specifier MUST be prefixed by one or
312 # more numeric part specifiers.
313
314 imap4d_test "FETCH 3 BODY\[1.MIME\]"\
315 "3 FETCH (FLAGS (\\Seen) BODY\[1.MIME\] {145}"\
316 -literal\
317 "Content-Type: text/plain; name=\"msg.1\"; charset=\"us-ascii\""\
318 "Content-ID: <5082.1026510189.1@Mirddin.farlep.net>"\
319 "Content-Description: How doth"\
320 ""\
321 ")"\
322 "OK"
323
324
325 imap4d_test "FETCH 4 BODY\[2.2.1\]"\
326 "4 FETCH (FLAGS (\\Seen) BODY\[2.2.1\] {492}"\
327 -literal\
328 "YFlvdSBhcmUgb2xkLCcgc2FpZCB0aGUgeW91dGgsIGBhbmQgeW91ciBqYXdzIGFyZSB0b28gd2Vh"\
329 "awpGb3IgYW55dGhpbmcgdG91Z2hlciB0aGFuIHN1ZXQ7CllldCB5b3UgZmluaXNoZWQgdGhlIGdv"\
330 "b3NlLCB3aXRoIHRoZSBib25lcyBhbmQgdGhlIGJlYWstLQpQcmF5IGhvdyBkaWQgeW91IG1hbmFn"\
331 "ZSB0byBkbyBpdD8nCgpgSW4gbXkgeW91dGgsJyBzYWlkIGhpcyBmYXRoZXIsIGBJIHRvb2sgdG8g"\
332 "dGhlIGxhdywKQW5kIGFyZ3VlZCBlYWNoIGNhc2Ugd2l0aCBteSB3aWZlOwpBbmQgdGhlIG11c2N1"\
333 "bGFyIHN0cmVuZ3RoLCB3aGljaCBpdCBnYXZlIHRvIG15IGphdywKSGFzIGxhc3RlZCB0aGUgcmVz"\
334 "dCBvZiBteSBsaWZlLicK"\
335 ""\
336 ")"\
337 "OK"
338
339 imap4d_test "FETCH 4 BODY\[2.2.1.TEXT\]"\
340 "4 FETCH (BODY\[2.2.1.TEXT\] {492}"\
341 -literal\
342 "YFlvdSBhcmUgb2xkLCcgc2FpZCB0aGUgeW91dGgsIGBhbmQgeW91ciBqYXdzIGFyZSB0b28gd2Vh"\
343 "awpGb3IgYW55dGhpbmcgdG91Z2hlciB0aGFuIHN1ZXQ7CllldCB5b3UgZmluaXNoZWQgdGhlIGdv"\
344 "b3NlLCB3aXRoIHRoZSBib25lcyBhbmQgdGhlIGJlYWstLQpQcmF5IGhvdyBkaWQgeW91IG1hbmFn"\
345 "ZSB0byBkbyBpdD8nCgpgSW4gbXkgeW91dGgsJyBzYWlkIGhpcyBmYXRoZXIsIGBJIHRvb2sgdG8g"\
346 "dGhlIGxhdywKQW5kIGFyZ3VlZCBlYWNoIGNhc2Ugd2l0aCBteSB3aWZlOwpBbmQgdGhlIG11c2N1"\
347 "bGFyIHN0cmVuZ3RoLCB3aGljaCBpdCBnYXZlIHRvIG15IGphdywKSGFzIGxhc3RlZCB0aGUgcmVz"\
348 "dCBvZiBteSBsaWZlLicK"\
349 ""\
350 ")"\
351 "OK"
352
353 imap4d_test "FETCH 4 BODY\[2.2.TEXT\]"\
354 "4 FETCH (BODY\[2.2.TEXT\] {1448}"\
355 -literal\
356 -- "------- =_aaaaaaaaaa2"\
357 "Content-Type: application/octet-stream; name=\"msg.23\""\
358 "Content-ID: <5122.1026510654.6@Mirddin.farlep.net>"\
359 "Content-Description: Father William Part III"\
360 "Content-Transfer-Encoding: base64"\
361 ""\
362 "YFlvdSBhcmUgb2xkLCcgc2FpZCB0aGUgeW91dGgsIGBhbmQgeW91ciBqYXdzIGFyZSB0b28gd2Vh"\
363 "awpGb3IgYW55dGhpbmcgdG91Z2hlciB0aGFuIHN1ZXQ7CllldCB5b3UgZmluaXNoZWQgdGhlIGdv"\
364 "b3NlLCB3aXRoIHRoZSBib25lcyBhbmQgdGhlIGJlYWstLQpQcmF5IGhvdyBkaWQgeW91IG1hbmFn"\
365 "ZSB0byBkbyBpdD8nCgpgSW4gbXkgeW91dGgsJyBzYWlkIGhpcyBmYXRoZXIsIGBJIHRvb2sgdG8g"\
366 "dGhlIGxhdywKQW5kIGFyZ3VlZCBlYWNoIGNhc2Ugd2l0aCBteSB3aWZlOwpBbmQgdGhlIG11c2N1"\
367 "bGFyIHN0cmVuZ3RoLCB3aGljaCBpdCBnYXZlIHRvIG15IGphdywKSGFzIGxhc3RlZCB0aGUgcmVz"\
368 "dCBvZiBteSBsaWZlLicK"\
369 ""\
370 -- "------- =_aaaaaaaaaa2"\
371 "Content-Type: application/octet-stream; name=\"msg.24\""\
372 "Content-ID: <5122.1026510654.7@Mirddin.farlep.net>"\
373 "Content-Description: Father William Part IV"\
374 "Content-Transfer-Encoding: base64"\
375 ""\
376 "YFlvdSBhcmUgb2xkLCcgc2FpZCB0aGUgeW91dGgsIGBvbmUgd291bGQgaGFyZGx5IHN1cHBvc2UK"\
377 "VGhhdCB5b3VyIGV5ZSB3YXMgYXMgc3RlYWR5IGFzIGV2ZXI7CllldCB5b3UgYmFsYW5jZWQgYW4g"\
378 "ZWVsIG9uIHRoZSBlbmQgb2YgeW91ciBub3NlLS0KV2hhdCBtYWRlIHlvdSBzbyBhd2Z1bGx5IGNs"\
379 "ZXZlcj8nCgpgSSBoYXZlIGFuc3dlcmVkIHRocmVlIHF1ZXN0aW9ucywgYW5kIHRoYXQgaXMgZW5v"\
380 "dWdoLCcKU2FpZCBoaXMgZmF0aGVyOyBgZG9uJ3QgZ2l2ZSB5b3Vyc2VsZiBhaXJzIQpEbyB5b3Ug"\
381 "dGhpbmsgSSBjYW4gbGlzdGVuIGFsbCBkYXkgdG8gc3VjaCBzdHVmZj8KQmUgb2ZmLCBvciBJJ2xs"\
382 "IGtpY2sgeW91IGRvd24gc3RhaXJzIScK"\
383 ""\
384 -- "------- =_aaaaaaaaaa2--"\
385 ""\
386 ")"\
387 "OK"
388
389 ###############
390 # Test RFC822 operations
391
392 # Clean \Seen flags
393
394 imap4d_test "STORE 1:* -FLAGS (\\Seen)"\
395 "1 FETCH FLAGS (\\Recent)"\
396 "2 FETCH FLAGS (\\Recent)"\
397 "3 FETCH FLAGS (\\Recent)"\
398 "4 FETCH FLAGS (\\Recent)"\
399 "OK"
400
401 # RFC822 Functionally equivalent to BODY[], differing in the
402 # syntax of the resulting untagged FETCH data (RFC822
403 # is returned).
404
405 imap4d_test "FETCH 1 RFC822"\
406 "1 FETCH (FLAGS (\\Seen) RFC822 {1299}"\
407 -literal\
408 "Received: (from foobar@nonexistent.net) "\
409 " by nonexistent.net id fBSKI8N04906"\
410 " for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
411 "Date: Fri, 28 Dec 2001 22:18:08 +0200"\
412 "From: Foo Bar <foobar@nonexistent.net>"\
413 "Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
414 "To: Bar <bar@dontmailme.org>"\
415 "Subject: Jabberwocky"\
416 ""\
417 "`Twas brillig, and the slithy toves"\
418 "Did gyre and gimble in the wabe;"\
419 "All mimsy were the borogoves,"\
420 "And the mome raths outgrabe."\
421 ""\
422 "`Beware the Jabberwock, my son!"\
423 "The jaws that bite, the claws that catch!"\
424 "Beware the Jujub bird, and shun"\
425 "The frumious Bandersnatch!'"\
426 ""\
427 "He took his vorpal sword in hand:"\
428 "Long time the manxome foe he sought --"\
429 "So rested he by the Tumtum gree,"\
430 "And stood awhile in thought."\
431 ""\
432 "And as in uffish thought he stood,"\
433 "The Jabberwock, with eyes of flame,"\
434 "Came whiffling through the tulgey wook,"\
435 "And burbled as it came!"\
436 ""\
437 "One, two! One, two! And through and through"\
438 "The vorpal blade went snicker-snack!"\
439 "He left it dead, and with its head"\
440 "He went galumphing back."\
441 ""\
442 "`And has thou slain the Jabberwock?"\
443 "Come to my arms, my beamish boy!"\
444 "O frabjous day! Calloh! Callay!"\
445 "He chortled in his joy."\
446 ""\
447 "`Twas brillig, and the slithy toves"\
448 "Did gyre and gimble in the wabe;"\
449 "All mimsy were the borogoves,"\
450 "And the mome raths outgrabe."\
451 ""\
452 ")"\
453 "OK"
454
455 # RFC822.HEADER Functionally equivalent to BODY.PEEK[HEADER],
456 # differing in the syntax of the resulting untagged
457 # FETCH data (RFC822.HEADER is returned).
458
459 imap4d_test "FETCH 2 RFC822.HEADER"\
460 "2 FETCH (RFC822.HEADER {329}"\
461 -literal\
462 "Received: (from bar@dontmailme.org) "\
463 " by dontmailme.org id fERKR9N16790"\
464 " for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200"\
465 "Date: Fri, 28 Dec 2001 23:28:08 +0200"\
466 "From: Bar <bar@dontmailme.org>"\
467 "To: Foo Bar <foobar@nonexistent.net>"\
468 "Message-Id: <200112232808.fERKR9N16790@dontmailme.org>"\
469 "Subject: Re: Jabberwocky"\
470 ""\
471 ")"\
472 "OK"
473
474 # RFC822.SIZE The [RFC-822] size of the message.
475
476 imap4d_test "FETCH 3 RFC822.SIZE"\
477 "3 FETCH (RFC822.SIZE 1668)"\
478 "OK"
479
480 # RFC822.TEXT Functionally equivalent to BODY[TEXT], differing in
481 # the syntax of the resulting untagged FETCH data
482 # (RFC822.TEXT is returned).
483 imap4d_test "FETCH 2 RFC822.TEXT"\
484 "2 FETCH (FLAGS (\\Seen) RFC822.TEXT {219}"\
485 -literal\
486 "It seems very pretty, but it's *rather* hard to understand!'"\
487 "Somehow it seems to fill my head with ideas -- only I don't"\
488 "exactly know what they are! However, SOMEBODY killed SOMETHING:"\
489 "that's clear, at any rate..."\
490 ")"\
491 "OK"
492
493 # FAST Macro equivalent to: (FLAGS INTERNALDATE
494 # RFC822.SIZE)
495
496 imap4d_test "FETCH 1 FAST" \
497 "1 FETCH (FLAGS (\\Seen \\Recent) INTERNALDATE \"28-Dec-2001 23:18:09 +0000\" RFC822.SIZE 1299)"\
498 "OK"
499
500 # FULL Macro equivalent to: (FLAGS INTERNALDATE
501 # RFC822.SIZE ENVELOPE BODY)
502
503 imap4d_test "FETCH 4 FULL"\
504 "4 FETCH (FLAGS (\\Recent) INTERNALDATE \"13-Jul-2002 00:50:58 +0000\" RFC822.SIZE 3568 ENVELOPE (\"Sat, 13 Jul 2002 00:50:58 +0300\" \"Nested MIME\"((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Sergey Poznyakoff\" NIL \"gray\" \"Mirddin.farlep.net\")) ((\"Foo Bar\" NIL \"foobar\" \"nonexistent.net\")) ((NIL NIL \"NIL\" NIL)) ((NIL NIL \"NIL\" NIL)) NIL \"<200207122150.g6CLowb05126@Mirddin.farlep.net>\") BODY ((\"text\" \"plain\" (\"name\" \"msg.21\" \"charset\" \"us-ascii\") \"<5122.1026510654.2@Mirddin.farlep.net>\" \"Father William Part I\" 7BIT 353 11)((\"application\" \"octet-stream\" (\"name\" \"msg.22\") \"<5122.1026510654.4@Mirddin.farlep.net>\" \"Father William Part II\" \"base64\" 488)((\"application\" \"octet-stream\" (\"name\" \"msg.23\") \"<5122.1026510654.6@Mirddin.farlep.net>\" \"Father William Part III\" \"base64\" 492)(\"application\" \"octet-stream\" (\"name\" \"msg.24\") \"<5122.1026510654.7@Mirddin.farlep.net>\" \"Father William Part IV\" \"base64\" 504) \"mixed\" NIL NIL NIL) \"mixed\" NIL NIL NIL) \"mixed\" NIL NIL NIL))"\
505 "OK"
506
507 #end of fetch.exp
...\ No newline at end of file ...\ No newline at end of file
1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, Free Software Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 imap4d_start
20
21 imap4d_test -message "X-VERSION in initail state" "X-VERSION"\
22 "BAD X-VERSION Wrong state"
23
24 imap4d_auth "user!passwd" "guessme"
25
26 imap4d_test -message "X-VERSION in auth state" "X-VERSION"\
27 "X-VERSION GNU imap4d (GNU Mailutils [mu_check_capability VERSION])"\
28 "OK"
...\ No newline at end of file ...\ No newline at end of file