]> code.citadel.org Git - citadel.git/commitdiff
* More changes to the handling of RFC822 headers with regard to
authorArt Cancro <ajc@citadel.org>
Wed, 12 Mar 2003 03:33:54 +0000 (03:33 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 12 Mar 2003 03:33:54 +0000 (03:33 +0000)
  splitting up the headers and body.  (Blank lines and such.)

citadel/ChangeLog
citadel/msgbase.c

index 5335373afa59be17f6a43030af7cc9d3842ff533..008251cd8c6735a4fecdd28b256f21412727465b 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 605.14  2003/03/12 03:33:54  ajc
+ * More changes to the handling of RFC822 headers with regard to
+   splitting up the headers and body.  (Blank lines and such.)
+
  Revision 605.13  2003/03/11 06:23:50  ajc
  * More accurate handling of IMAP FETCH xx BODYSTRUCTURE command.  This should
    make Pine happier with multipart messages.
@@ -4537,4 +4541,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 3654b65f1992e50c8286bae5f69837a2b68c1eea..0d70d211a5a3c41044fc02934301874bdfeea868 100644 (file)
@@ -1313,7 +1313,9 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                cprintf("Organization: %s%s", lnode, nl);
 
                /* Blank line signifying RFC822 end-of-headers */
-               cprintf("%s", nl);
+               if (TheMessage->cm_format_type != FMT_RFC822) {
+                       cprintf("%s", nl);
+               }
        }
 
        /* end header processing loop ... at this point, we're in the text */
@@ -1335,19 +1337,48 @@ START_TEXT:
                         * Citadel and RFC822 headers exist.  Preference should
                         * probably be given to the RFC822 headers.
                         */
+                       int done_rfc822_hdrs = 0;
                        while (ch=*(mptr++), ch!=0) {
-                               if (ch==13) ;
-                               else if (ch==10) cprintf("%s", nl);
-                               else cprintf("%c", ch);
+                               if (ch==13) {
+                                       /* do nothing */
+                               }
+                               else if (ch==10) {
+                                       if (!done_rfc822_hdrs) {
+                                               if (headers_only != HEADERS_NONE) {
+                                                       cprintf("%s", nl);
+                                               }
+                                       }
+                                       else {
+                                               if (headers_only != HEADERS_ONLY) {
+                                                       cprintf("%s", nl);
+                                               }
+                                       }
+                                       if ((*(mptr) == 13) || (*(mptr) == 10)) {
+                                               done_rfc822_hdrs = 1;
+                                       }
+                               }
+                               else {
+                                       if (done_rfc822_hdrs) {
+                                               if (headers_only != HEADERS_NONE) {
+                                                       cprintf("%c", ch);
+                                               }
+                                       }
+                                       else {
+                                               if (headers_only != HEADERS_ONLY) {
+                                                       cprintf("%c", ch);
+                                               }
+                                       }
+                                       if ((*mptr == 13) || (*mptr == 10)) {
+                                               done_rfc822_hdrs = 1;
+                                       }
+                               }
                        }
-                       if (do_proto) cprintf("000\n");
-                       return(om_ok);
+                       goto DONE;
                }
        }
 
        if (headers_only == HEADERS_ONLY) {
-               if (do_proto) cprintf("000\n");
-               return(om_ok);
+               goto DONE;
        }
 
        /* signify start of msg text */
@@ -1417,7 +1448,7 @@ START_TEXT:
                }
        }
 
-       /* now we're done */
+DONE:  /* now we're done */
        if (do_proto) cprintf("000\n");
        return(om_ok);
 }