]> code.citadel.org Git - citadel.git/commitdiff
* xx FETCH n:n BODY[pn.MIME] now works
authorArt Cancro <ajc@citadel.org>
Tue, 7 Nov 2000 15:54:53 +0000 (15:54 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 7 Nov 2000 15:54:53 +0000 (15:54 +0000)
citadel/ChangeLog
citadel/imap_fetch.c

index 567066a949c48131eaea2ed8d6d03bb39e711ed2..94f7cf697d80072a07c55909014def63c0d874eb 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.21  2000/11/07 15:54:53  ajc
+ * xx FETCH n:n BODY[pn.MIME] now works
+
  Revision 573.20  2000/11/06 05:10:01  ajc
  * Changed the mime_parser() API (again) to allow "don't decode" mode
 
@@ -2119,3 +2122,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 2dcb373e79197b5ae6a8a0d9fd0cad7fcea0b49e..f15a6bec0bcd6569efe936bb036b9dca2c8b62fc 100644 (file)
@@ -175,6 +175,7 @@ void imap_load_part(char *name, char *filename, char *partnum, char *disp,
                    void *cbuserdata)
 {
        struct imap_fetch_part *imfp;
+       char mbuf2[1024];
 
        imfp = (struct imap_fetch_part *)cbuserdata;
 
@@ -182,6 +183,30 @@ void imap_load_part(char *name, char *filename, char *partnum, char *disp,
                fwrite(content, length, 1, imfp->output_fp);
        }
 
+       sprintf(mbuf2, "%s.MIME", partnum);
+
+       if (!strcasecmp(imfp->desired_section, mbuf2)) {
+               fprintf(imfp->output_fp, "Content-type: %s", cbtype);
+               if (strlen(name) > 0)
+                       fprintf(imfp->output_fp, "; name=\"%s\"", name);
+               fprintf(imfp->output_fp, "\r\n");
+               if (strlen(encoding) > 0)
+                       fprintf(imfp->output_fp,
+                               "Content-Transfer-Encoding: %s\r\n", encoding);
+               if (strlen(encoding) > 0) {
+                       fprintf(imfp->output_fp, "Content-Disposition: %s",
+                                       disp);
+                       if (strlen(filename) > 0) {
+                               fprintf(imfp->output_fp, "; filename=\"%s\"",
+                                       filename);
+                       }
+                       fprintf(imfp->output_fp, "\r\n");
+               }
+               fprintf(imfp->output_fp, "Content-Length: %d\r\n", length);
+               fprintf(imfp->output_fp, "\r\n");
+       }
+                       
+
 }
 
 
@@ -316,10 +341,12 @@ void imap_do_fetch_msg(int seq, struct CtdlMessage *msg,
        for (i=0; i<num_items; ++i) {
 
                if (!strncasecmp(itemlist[i], "BODY[", 5)) {
-                       imap_fetch_body(IMAP->msgids[seq-1], itemlist[i], 0, msg);
+                       imap_fetch_body(IMAP->msgids[seq-1], itemlist[i],
+                                       0, msg);
                }
                else if (!strncasecmp(itemlist[i], "BODY.PEEK[", 10)) {
-                       imap_fetch_body(IMAP->msgids[seq-1], itemlist[i], 1, msg);
+                       imap_fetch_body(IMAP->msgids[seq-1], itemlist[i],
+                                       1, msg);
                }
                else if (!strcasecmp(itemlist[i], "BODYSTRUCTURE")) {
                        /* FIXME do something here */