]> code.citadel.org Git - citadel.git/blob - citadel/imap_fetch.c
* I dunno, something I did made it work with Netscape 6 Mail :)
[citadel.git] / citadel / imap_fetch.c
1 /*
2  * $Id$
3  *
4  * Implements the FETCH command in IMAP.
5  * This command is way too convoluted.  Marc Crispin is a fscking idiot.
6  *
7  */
8
9
10 #include "sysdep.h"
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <stdio.h>
14 #include <fcntl.h>
15 #include <signal.h>
16 #include <pwd.h>
17 #include <errno.h>
18 #include <sys/types.h>
19 #include <sys/time.h>
20 #include <sys/wait.h>
21 #include <ctype.h>
22 #include <string.h>
23 #include <limits.h>
24 #include "citadel.h"
25 #include "server.h"
26 #include <time.h>
27 #include "sysdep_decls.h"
28 #include "citserver.h"
29 #include "support.h"
30 #include "config.h"
31 #include "dynloader.h"
32 #include "room_ops.h"
33 #include "user_ops.h"
34 #include "policy.h"
35 #include "database.h"
36 #include "msgbase.h"
37 #include "tools.h"
38 #include "internet_addressing.h"
39 #include "mime_parser.h"
40 #include "serv_imap.h"
41 #include "imap_tools.h"
42 #include "imap_fetch.h"
43 #include "genstamp.h"
44
45
46
47 struct imap_fetch_part {
48         char desired_section[256];
49         FILE *output_fp;
50 };
51
52 /*
53  * Individual field functions for imap_do_fetch_msg() ...
54  */
55
56
57
58 void imap_fetch_uid(int seq) {
59         cprintf("UID %ld", IMAP->msgids[seq-1]);
60 }
61
62 void imap_fetch_flags(struct CtdlMessage *msg) {
63         cprintf("FLAGS ()");    /* FIXME do something here */
64 }
65
66 void imap_fetch_internaldate(struct CtdlMessage *msg) {
67         char buf[256];
68         time_t msgdate;
69
70         if (msg->cm_fields['T'] != NULL) {
71                 msgdate = atol(msg->cm_fields['T']);
72         }
73         else {
74                 msgdate = time(NULL);
75         }
76
77         datestring(buf, msgdate, DATESTRING_IMAP);
78         cprintf("INTERNALDATE \"%s\"", buf);
79 }
80
81
82 /*
83  * Fetch RFC822-formatted messages.
84  *
85  * 'whichfmt' should be set to one of:
86  *      "RFC822"        entire message
87  *      "RFC822.HEADER" headers only (with trailing blank line)
88  *      "RFC822.SIZE"   size of translated message
89  *      "RFC822.TEXT"   body only (without leading blank line)
90  */
91 void imap_fetch_rfc822(int msgnum, char *whichfmt) {
92         FILE *tmp;
93         char buf[1024];
94         char *ptr;
95         long headers_size, text_size, total_size;
96         long bytes_remaining = 0;
97         long blocksize;
98
99         tmp = tmpfile();
100         if (tmp == NULL) {
101                 lprintf(1, "Cannot open temp file: %s\n", strerror(errno));
102                 return;
103         }
104
105         /*
106          * Load the message into a temp file for translation and measurement
107          */ 
108         CtdlRedirectOutput(tmp, -1);
109         CtdlOutputMsg(msgnum, MT_RFC822, 0, 0, 1);
110         CtdlRedirectOutput(NULL, -1);
111
112         /*
113          * Now figure out where the headers/text break is.  IMAP considers the
114          * intervening blank line to be part of the headers, not the text.
115          */
116         rewind(tmp);
117         headers_size = 0L;
118         do {
119                 ptr = fgets(buf, sizeof buf, tmp);
120                 if (ptr != NULL) {
121                         striplt(buf);
122                         if (strlen(buf) == 0) headers_size = ftell(tmp);
123                 }
124         } while ( (headers_size == 0L) && (ptr != NULL) );
125         fseek(tmp, 0L, SEEK_END);
126         total_size = ftell(tmp);
127         text_size = total_size - headers_size;
128
129         if (!strcasecmp(whichfmt, "RFC822.SIZE")) {
130                 cprintf("RFC822.SIZE %ld", total_size);
131                 fclose(tmp);
132                 return;
133         }
134
135         else if (!strcasecmp(whichfmt, "RFC822")) {
136                 bytes_remaining = total_size;
137                 rewind(tmp);
138         }
139
140         else if (!strcasecmp(whichfmt, "RFC822.HEADER")) {
141                 bytes_remaining = headers_size;
142                 rewind(tmp);
143         }
144
145         else if (!strcasecmp(whichfmt, "RFC822.TEXT")) {
146                 bytes_remaining = text_size;
147                 fseek(tmp, headers_size, SEEK_SET);
148         }
149
150         cprintf("%s {%ld}\r\n", whichfmt, bytes_remaining);
151         blocksize = sizeof(buf);
152         while (bytes_remaining > 0L) {
153                 if (blocksize > bytes_remaining) blocksize = bytes_remaining;
154                 fread(buf, blocksize, 1, tmp);
155                 client_write(buf, blocksize);
156                 bytes_remaining = bytes_remaining - blocksize;
157         }
158
159         fclose(tmp);
160 }
161
162
163
164 /*
165  * Load a specific part of a message into the temp file to be output to a
166  * client.  FIXME we can handle parts like "2" and "2.1" and even "2.MIME"
167  * but we still can't handle "2.HEADER" (which might not be a problem, because
168  * we currently don't have the ability to break out nested RFC822's anyway).
169  *
170  * Note: mime_parser() was called with dont_decode set to 1, so we have the
171  * luxury of simply spewing without having to re-encode.
172  */
173 void imap_load_part(char *name, char *filename, char *partnum, char *disp,
174                     void *content, char *cbtype, size_t length, char *encoding,
175                     void *cbuserdata)
176 {
177         struct imap_fetch_part *imfp;
178         char mbuf2[1024];
179
180         imfp = (struct imap_fetch_part *)cbuserdata;
181
182         if (!strcasecmp(partnum, imfp->desired_section)) {
183                 fwrite(content, length, 1, imfp->output_fp);
184         }
185
186         sprintf(mbuf2, "%s.MIME", partnum);
187
188         if (!strcasecmp(imfp->desired_section, mbuf2)) {
189                 fprintf(imfp->output_fp, "Content-type: %s", cbtype);
190                 if (strlen(name) > 0)
191                         fprintf(imfp->output_fp, "; name=\"%s\"", name);
192                 fprintf(imfp->output_fp, "\r\n");
193                 if (strlen(encoding) > 0)
194                         fprintf(imfp->output_fp,
195                                 "Content-Transfer-Encoding: %s\r\n", encoding);
196                 if (strlen(encoding) > 0) {
197                         fprintf(imfp->output_fp, "Content-Disposition: %s",
198                                         disp);
199                         if (strlen(filename) > 0) {
200                                 fprintf(imfp->output_fp, "; filename=\"%s\"",
201                                         filename);
202                         }
203                         fprintf(imfp->output_fp, "\r\n");
204                 }
205                 fprintf(imfp->output_fp, "Content-Length: %d\r\n", length);
206                 fprintf(imfp->output_fp, "\r\n");
207         }
208                         
209
210 }
211
212
213 /*
214  * Implements the ENVELOPE fetch item
215  * 
216  * FIXME ... we have to actually do something useful here.
217  *
218  * Note that the imap_strout() function can cleverly output NULL fields as NIL,
219  * so we don't have to check for that condition like we do elsewhere.
220  */
221 void imap_fetch_envelope(long msgnum, struct CtdlMessage *msg) {
222         char buf[256];
223         time_t msgdate;
224
225         if (msg->cm_fields['T'] != NULL) {
226                 msgdate = atol(msg->cm_fields['T']);
227         }
228         else {
229                 msgdate = time(NULL);
230         }
231
232         datestring(buf, msgdate, DATESTRING_IMAP);
233
234         cprintf("ENVELOPE (");
235
236         /* date */
237         cprintf("\"%s\" ", buf);
238
239         /* subject */
240         imap_strout(msg->cm_fields['U']);
241         cprintf(" ");
242
243         cprintf("NIL ");        /* from */
244         cprintf("NIL ");        /* sender */
245         cprintf("NIL ");        /* reply-to */
246         cprintf("NIL ");        /* to */
247         cprintf("NIL ");        /* cc */
248         cprintf("NIL ");        /* bcc */
249         cprintf("NIL ");        /* in-reply-to */
250
251         /* message ID */
252         imap_strout(msg->cm_fields['I']);
253
254         cprintf(") ");
255 }
256
257
258 /*
259  * Strip any non header information out of a chunk of RFC822 data on disk
260  */
261 void imap_strip_headers(FILE *fp) {
262         char buf[1024];
263
264         rewind(fp);
265         while (fgets(buf, sizeof buf, fp) != NULL) {
266                 striplt(buf);
267                 if (strlen(buf) == 0) {
268                         fflush(fp);
269                         ftruncate(fileno(fp), ftell(fp));
270                 }
271         }
272         fflush(fp);
273         fprintf(fp, "\r\n");    /* add the trailing newline */
274         rewind(fp);
275 }
276
277
278 /*
279  * Implements the BODY and BODY.PEEK fetch items
280  */
281 void imap_fetch_body(long msgnum, char *item, int is_peek,
282                 struct CtdlMessage *msg) {
283         char section[1024];
284         char partial[1024];
285         int is_partial = 0;
286         char buf[1024];
287         int i;
288         FILE *tmp;
289         long bytes_remaining = 0;
290         long blocksize;
291         long pstart, pbytes;
292         struct imap_fetch_part imfp;
293
294         /* extract section */
295         strcpy(section, item);
296         for (i=0; i<strlen(section); ++i) {
297                 if (section[i]=='[') strcpy(section, &section[i+1]);
298         }
299         for (i=0; i<strlen(section); ++i) {
300                 if (section[i]==']') section[i] = 0;
301         }
302         lprintf(9, "Section is %s\n", section);
303
304         /* extract partial */
305         strcpy(partial, item);
306         for (i=0; i<strlen(partial); ++i) {
307                 if (partial[i]=='<') {
308                         strcpy(partial, &partial[i+1]);
309                         is_partial = 1;
310                 }
311         }
312         for (i=0; i<strlen(partial); ++i) {
313                 if (partial[i]=='>') partial[i] = 0;
314         }
315         if (is_partial == 0) strcpy(partial, "");
316         lprintf(9, "Partial is %s\n", partial);
317
318         tmp = tmpfile();
319         if (tmp == NULL) {
320                 lprintf(1, "Cannot open temp file: %s\n", strerror(errno));
321                 return;
322         }
323
324         /* Now figure out what the client wants, and get it */
325
326         if (!strcmp(section, "")) {             /* the whole thing */
327                 CtdlRedirectOutput(tmp, -1);
328                 CtdlOutputMsg(msgnum, MT_RFC822, 0, 0, 1);
329                 CtdlRedirectOutput(NULL, -1);
330         }
331
332         /*
333          * Be obnoxious and send the entire header, even if the client only
334          * asks for certain fields.  FIXME this shortcut later.
335          */
336         else if (!strncasecmp(section, "HEADER", 6)) {
337                 CtdlRedirectOutput(tmp, -1);
338                 CtdlOutputMsg(msgnum, MT_RFC822, 1, 0, 1);
339                 CtdlRedirectOutput(NULL, -1);
340                 imap_strip_headers(tmp);
341         }
342
343         /*
344          * Anything else must be a part specifier.
345          * (Note value of 1 passed as 'dont_decode' so client gets it encoded)
346          */
347         else {
348                 safestrncpy(imfp.desired_section, section,
349                                 sizeof(imfp.desired_section));
350                 imfp.output_fp = tmp;
351
352                 mime_parser(msg->cm_fields['M'], NULL,
353                                 *imap_load_part,
354                                 (void *)&imfp,
355                                 1);
356         }
357
358
359         fseek(tmp, 0L, SEEK_END);
360         bytes_remaining = ftell(tmp);
361
362         if (is_partial == 0) {
363                 rewind(tmp);
364                 cprintf("BODY[%s] {%ld}\r\n", section, bytes_remaining);
365         }
366         else {
367                 sscanf(partial, "%ld.%ld", &pstart, &pbytes);
368                 if ((bytes_remaining - pstart) < pbytes) {
369                         pbytes = bytes_remaining - pstart;
370                 }
371                 fseek(tmp, pstart, SEEK_SET);
372                 bytes_remaining = pbytes;
373                 cprintf("BODY[%s] {%ld}<%ld>\r\n",
374                         section, bytes_remaining, pstart);
375         }
376
377         blocksize = sizeof(buf);
378         while (bytes_remaining > 0L) {
379                 if (blocksize > bytes_remaining) blocksize = bytes_remaining;
380                 fread(buf, blocksize, 1, tmp);
381                 client_write(buf, blocksize);
382                 bytes_remaining = bytes_remaining - blocksize;
383         }
384
385         fclose(tmp);
386
387         if (is_peek) {
388                 /* FIXME set the last read pointer or something */
389         }
390 }
391
392
393
394 /*
395  * imap_do_fetch() calls imap_do_fetch_msg() to output the deta of an
396  * individual message, once it has been successfully loaded from disk.
397  */
398 void imap_do_fetch_msg(int seq, struct CtdlMessage *msg,
399                         int num_items, char **itemlist) {
400         int i;
401
402         cprintf("* %d FETCH (", seq);
403
404         for (i=0; i<num_items; ++i) {
405
406                 if (!strncasecmp(itemlist[i], "BODY[", 5)) {
407                         imap_fetch_body(IMAP->msgids[seq-1], itemlist[i],
408                                         0, msg);
409                 }
410                 else if (!strncasecmp(itemlist[i], "BODY.PEEK[", 10)) {
411                         imap_fetch_body(IMAP->msgids[seq-1], itemlist[i],
412                                         1, msg);
413                 }
414                 else if (!strcasecmp(itemlist[i], "BODYSTRUCTURE")) {
415                         /* FIXME do something here */
416                 }
417                 else if (!strcasecmp(itemlist[i], "ENVELOPE")) {
418                         imap_fetch_envelope(IMAP->msgids[seq-1], msg);
419                 }
420                 else if (!strcasecmp(itemlist[i], "FLAGS")) {
421                         imap_fetch_flags(msg);
422                 }
423                 else if (!strcasecmp(itemlist[i], "INTERNALDATE")) {
424                         imap_fetch_internaldate(msg);
425                 }
426                 else if (!strcasecmp(itemlist[i], "RFC822")) {
427                         imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
428                 }
429                 else if (!strcasecmp(itemlist[i], "RFC822.HEADER")) {
430                         imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
431                 }
432                 else if (!strcasecmp(itemlist[i], "RFC822.SIZE")) {
433                         imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
434                 }
435                 else if (!strcasecmp(itemlist[i], "RFC822.TEXT")) {
436                         imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
437                 }
438                 else if (!strcasecmp(itemlist[i], "UID")) {
439                         imap_fetch_uid(seq);
440                 }
441
442                 if (i != num_items-1) cprintf(" ");
443         }
444
445         cprintf(")\r\n");
446 }
447
448
449
450 /*
451  * imap_fetch() calls imap_do_fetch() to do its actual work, once it's
452  * validated and boiled down the request a bit.
453  */
454 void imap_do_fetch(int num_items, char **itemlist) {
455         int i;
456         struct CtdlMessage *msg;
457
458         if (IMAP->num_msgs > 0)
459          for (i = 0; i < IMAP->num_msgs; ++i)
460           if (IMAP->flags[i] && IMAP_FETCHED) {
461                 msg = CtdlFetchMessage(IMAP->msgids[i]);
462                 if (msg != NULL) {
463                         imap_do_fetch_msg(i+1, msg, num_items, itemlist);
464                         CtdlFreeMessage(msg);
465                 }
466                 else {
467                         cprintf("* %d FETCH <internal error>\r\n", i+1);
468                 }
469         }
470 }
471
472
473
474 /*
475  * Back end for imap_handle_macros()
476  * Note that this function *only* looks at the beginning of the string.  It
477  * is not a generic search-and-replace function.
478  */
479 void imap_macro_replace(char *str, char *find, char *replace) {
480         char holdbuf[1024];
481
482         if (!strncasecmp(str, find, strlen(find))) {
483                 if (str[strlen(find)]==' ') {
484                         strcpy(holdbuf, &str[strlen(find)+1]);
485                         strcpy(str, replace);
486                         strcat(str, " ");
487                         strcat(str, holdbuf);
488                 }
489                 if (str[strlen(find)]==0) {
490                         strcpy(holdbuf, &str[strlen(find)+1]);
491                         strcpy(str, replace);
492                 }
493         }
494 }
495
496
497
498 /*
499  * Handle macros embedded in FETCH data items.
500  * (What the heck are macros doing in a wire protocol?  Are we trying to save
501  * the computer at the other end the trouble of typing a lot of characters?)
502  */
503 void imap_handle_macros(char *str) {
504         int i;
505         int nest = 0;
506
507         for (i=0; i<strlen(str); ++i) {
508                 if (str[i]=='(') ++nest;
509                 if (str[i]=='[') ++nest;
510                 if (str[i]=='<') ++nest;
511                 if (str[i]=='{') ++nest;
512                 if (str[i]==')') --nest;
513                 if (str[i]==']') --nest;
514                 if (str[i]=='>') --nest;
515                 if (str[i]=='}') --nest;
516
517                 if (nest <= 0) {
518                         imap_macro_replace(&str[i],
519                                 "ALL",
520                                 "FLAGS INTERNALDATE RFC822.SIZE ENVELOPE"
521                         );
522                         imap_macro_replace(&str[i],
523                                 "BODY",
524                                 "BODYSTRUCTURE"
525                         );
526                         imap_macro_replace(&str[i],
527                                 "FAST",
528                                 "FLAGS INTERNALDATE RFC822.SIZE"
529                         );
530                         imap_macro_replace(&str[i],
531                                 "FULL",
532                                 "FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY"
533                         );
534                 }
535         }
536 }
537
538
539 /*
540  * Break out the data items requested, possibly a parenthesized list.
541  * Returns the number of data items, or -1 if the list is invalid.
542  * NOTE: this function alters the string it is fed, and uses it as a buffer
543  * to hold the data for the pointers it returns.
544  */
545 int imap_extract_data_items(char **argv, char *items) {
546         int num_items = 0;
547         int nest = 0;
548         int i, initial_len;
549         char *start;
550
551         /* Convert all whitespace to ordinary space characters. */
552         for (i=0; i<strlen(items); ++i) {
553                 if (isspace(items[i])) items[i]=' ';
554         }
555
556         /* Strip leading and trailing whitespace, then strip leading and
557          * trailing parentheses if it's a list
558          */
559         striplt(items);
560         if ( (items[0]=='(') && (items[strlen(items)-1]==')') ) {
561                 items[strlen(items)-1] = 0;
562                 strcpy(items, &items[1]);
563                 striplt(items);
564         }
565
566         /* Parse any macro data items */
567         imap_handle_macros(items);
568
569         /*
570          * Now break out the data items.  We throw in one trailing space in
571          * order to avoid having to break out the last one manually.
572          */
573         strcat(items, " ");
574         start = items;
575         initial_len = strlen(items);
576         for (i=0; i<initial_len; ++i) {
577                 if (items[i]=='(') ++nest;
578                 if (items[i]=='[') ++nest;
579                 if (items[i]=='<') ++nest;
580                 if (items[i]=='{') ++nest;
581                 if (items[i]==')') --nest;
582                 if (items[i]==']') --nest;
583                 if (items[i]=='>') --nest;
584                 if (items[i]=='}') --nest;
585
586                 if (nest <= 0) if (items[i]==' ') {
587                         items[i] = 0;
588                         argv[num_items++] = start;
589                         start = &items[i+1];
590                 }
591         }
592
593         return(num_items);
594
595 }
596
597
598 /*
599  * One particularly hideous aspect of IMAP is that we have to allow the client
600  * to specify arbitrary ranges and/or sets of messages to fetch.  Citadel IMAP
601  * handles this by setting the IMAP_FETCHED flag for each message specified in
602  * the ranges/sets, then looping through the message array, outputting messages
603  * with the flag set.  We don't bother returning an error if an out-of-range
604  * number is specified (we just return quietly) because any client braindead
605  * enough to request a bogus message number isn't going to notice the
606  * difference anyway.
607  *
608  * This function clears out the IMAP_FETCHED bits, then sets that bit for each
609  * message included in the specified range.
610  *
611  * Set is_uid to 1 to fetch by UID instead of sequence number.
612  */
613 void imap_pick_range(char *range, int is_uid) {
614         int i;
615         int num_sets;
616         int s;
617         char setstr[1024], lostr[1024], histr[1024];
618         int lo, hi;
619
620         /*
621          * Clear out the IMAP_FETCHED flags for all messages.
622          */
623         for (i = 1; i <= IMAP->num_msgs; ++i) {
624                 IMAP->flags[i-1] = IMAP->flags[i-1] & ~IMAP_FETCHED;
625         }
626
627         /*
628          * Now set it for all specified messages.
629          */
630         num_sets = num_tokens(range, ',');
631         for (s=0; s<num_sets; ++s) {
632                 extract_token(setstr, range, s, ',');
633
634                 extract_token(lostr, setstr, 0, ':');
635                 if (num_tokens(setstr, ':') >= 2) {
636                         extract_token(histr, setstr, 1, ':');
637                         if (!strcmp(histr, "*")) sprintf(histr, "%d", INT_MAX);
638                 } 
639                 else {
640                         strcpy(histr, lostr);
641                 }
642                 lo = atoi(lostr);
643                 hi = atoi(histr);
644
645                 /* Loop through the array, flipping bits where appropriate */
646                 for (i = 1; i <= IMAP->num_msgs; ++i) {
647                         if (is_uid) {   /* fetch by sequence number */
648                                 if ( (IMAP->msgids[i-1]>=lo)
649                                    && (IMAP->msgids[i-1]<=hi)) {
650                                         IMAP->flags[i-1] =
651                                                 IMAP->flags[i-1] | IMAP_FETCHED;
652                                 }
653                         }
654                         else {          /* fetch by uid */
655                                 if ( (i>=lo) && (i<=hi)) {
656                                         IMAP->flags[i-1] =
657                                                 IMAP->flags[i-1] | IMAP_FETCHED;
658                                 }
659                         }
660                 }
661         }
662 }
663
664
665
666 /*
667  * This function is called by the main command loop.
668  */
669 void imap_fetch(int num_parms, char *parms[]) {
670         char items[1024];
671         char *itemlist[256];
672         int num_items;
673         int i;
674
675         if (num_parms < 4) {
676                 cprintf("%s BAD invalid parameters\r\n", parms[0]);
677                 return;
678         }
679
680         imap_pick_range(parms[2], 0);
681
682         strcpy(items, "");
683         for (i=3; i<num_parms; ++i) {
684                 strcat(items, parms[i]);
685                 if (i < (num_parms-1)) strcat(items, " ");
686         }
687
688         num_items = imap_extract_data_items(itemlist, items);
689         if (num_items < 1) {
690                 cprintf("%s BAD invalid data item list\r\n", parms[0]);
691                 return;
692         }
693
694         imap_do_fetch(num_items, itemlist);
695         cprintf("%s OK FETCH completed\r\n", parms[0]);
696 }
697
698 /*
699  * This function is called by the main command loop.
700  */
701 void imap_uidfetch(int num_parms, char *parms[]) {
702         char items[1024];
703         char *itemlist[256];
704         int num_items;
705         int i;
706         int have_uid_item = 0;
707
708         if (num_parms < 5) {
709                 cprintf("%s BAD invalid parameters\r\n", parms[0]);
710                 return;
711         }
712
713         imap_pick_range(parms[3], 1);
714
715         strcpy(items, "");
716         for (i=4; i<num_parms; ++i) {
717                 strcat(items, parms[i]);
718                 if (i < (num_parms-1)) strcat(items, " ");
719         }
720
721         num_items = imap_extract_data_items(itemlist, items);
722         if (num_items < 1) {
723                 cprintf("%s BAD invalid data item list\r\n", parms[0]);
724                 return;
725         }
726
727         /* If the "UID" item was not included, we include it implicitly
728          * because this is a UID FETCH command
729          */
730         for (i=0; i<num_items; ++i) {
731                 if (!strcasecmp(itemlist[i], "UID")) ++have_uid_item;
732         }
733         if (have_uid_item == 0) itemlist[num_items++] = "UID";
734
735         imap_do_fetch(num_items, itemlist);
736         cprintf("%s OK UID FETCH completed\r\n", parms[0]);
737 }
738
739