* Worked out the remaining bugs in IMAP FETCH for the BODYSTRUCTURE and
authorArt Cancro <ajc@citadel.org>
Tue, 13 Feb 2001 04:06:14 +0000 (04:06 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 13 Feb 2001 04:06:14 +0000 (04:06 +0000)
  BODY[n] data items.  I think.  So much protocol crud, so little time...

citadel/ChangeLog
citadel/imap_fetch.c
citadel/mime_parser.c
citadel/serv_imap.c

index 12b2cd5a15de4fc2d07581cdff857b01db6cc0e9..a2ffd6622d8829fe3b097c966a93ae1751182386 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 573.89  2001/02/13 04:06:14  ajc
+ * Worked out the remaining bugs in IMAP FETCH for the BODYSTRUCTURE and
+   BODY[n] data items.  I think.  So much protocol crud, so little time...
+
  Revision 573.88  2001/02/13 01:18:44  ajc
  * imap fetch
 
@@ -2400,4 +2404,3 @@ 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 8a580b239fb33904b4b8842fdcb3530a54927a2a..3683e2468c021d97f129b69c8d0de1eb42649945 100644 (file)
@@ -491,7 +491,6 @@ void imap_fetch_bodystructure_post(
 /*
  * Output the info for a MIME part in the format required by BODYSTRUCTURE.
  *
- * FIXME .... this needs oodles of work to get completed.
  */
 void imap_fetch_bodystructure_part(
                char *name, char *filename, char *partnum, char *disp,
@@ -546,9 +545,7 @@ void imap_fetch_bodystructure_part(
        cprintf(" ");
 
        cprintf("%ld ", length);        /* bytes */
-       cprintf("NIL ");                /* lines */
-       cprintf("NIL NIL NIL)");        /* I don't know what this is */
-
+       cprintf("NIL) ");               /* lines */
 }
 
 
@@ -558,7 +555,6 @@ void imap_fetch_bodystructure_part(
  * you're going to shoot a MIME?  Do you need a reason to shoot Mark Crispin?
  * No, and no.)
  *
- * FIXME finish the implementation
  */
 void imap_fetch_bodystructure (long msgnum, char *item,
                struct CtdlMessage *msg) {
@@ -567,7 +563,6 @@ void imap_fetch_bodystructure (long msgnum, char *item,
        long lines = 0L;
        long bytes = 0L;
 
-
        /* For non-RFC822 (ordinary Citadel) messages, this is short and
         * sweet...
         */
index fdacfb4c5aef0a178235ef1b77b4d11b87856241..a1dbe42e5235582c5d75f617b205b683bcb40af9 100644 (file)
@@ -75,6 +75,18 @@ char *memreadline(char *start, char *buf, int maxlen)
        }
 }
 
+
+/*
+ * For non-multipart messages, we need to generate a quickie partnum of "1"
+ * to return to callback functions.  Some callbacks demand it.
+ */
+char *fixed_partnum(char *supplied_partnum) {
+       if (supplied_partnum == NULL) return "1";
+       if (strlen(supplied_partnum)==0) return "1";
+       return supplied_partnum;
+}
+
+
 /*
  * Given a message or message-part body and a length, handle any necessary
  * decoding and pass the request up the stack.
@@ -142,7 +154,7 @@ void mime_decode(char *partnum,
        /* If this part is not encoded, send as-is */
        if ( (strlen(encoding) == 0) || (dont_decode)) {
                if (CallBack != NULL) {
-                       CallBack(name, filename, partnum,
+                       CallBack(name, filename, fixed_partnum(partnum),
                                disposition, part_start,
                                content_type, length, encoding, userdata);
                        }
@@ -223,8 +235,9 @@ void mime_decode(char *partnum,
        }
 
        if (bytes_recv > 0) if (CallBack != NULL) {
-               CallBack(name, filename, partnum, disposition, decoded,
-                        content_type, bytes_recv, "binary", userdata);
+               CallBack(name, filename, fixed_partnum(partnum),
+                       disposition, decoded,
+                       content_type, bytes_recv, "binary", userdata);
        }
 
        phree(decoded);
@@ -362,7 +375,8 @@ void the_mime_parser(char *partnum,
                }
                /*
                if (CallBack != NULL) {
-                       CallBack("", "", partnum, "", NULL, content_type,
+                       CallBack("", "", fixed_partnum(partnum),
+                               "", NULL, content_type,
                                0, encoding, userdata);
                }
                 */
index daffc1fd551eaeef5836fb6bfe247e792215e2ee..78174c5fbbc40a91750e98a2448fd232411d2acd 100644 (file)
@@ -408,7 +408,7 @@ void imap_list(int num_parms, char *parms[]) {
 
 
 /*
- * Implements the CREATE command (FIXME not finished yet)
+ * Implements the CREATE command
  *
  */
 void imap_create(int num_parms, char *parms[]) {