]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
* Tweaks to msgbase.c and imap_fetch.c to fix slightly incorrect byte counts
[citadel.git] / citadel / msgbase.c
index 6d6f8313e8eb4671acd69f67246335b06f69a722..3654b65f1992e50c8286bae5f69837a2b68c1eea 100644 (file)
@@ -1096,6 +1096,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
        char *mptr;
        char *nl;       /* newline string */
        int suppress_f = 0;
+       int subject_found = 0;
 
        /* buffers needed for RFC822 translation */
        char suser[SIZ];
@@ -1254,8 +1255,10 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                                        cprintf("Path: %s%s", mptr, nl);
                                }
  ****/
-                               else if (i == 'U')
+                               else if (i == 'U') {
                                        cprintf("Subject: %s%s", mptr, nl);
+                                       subject_found = 1;
+                               }
                                else if (i == 'I')
                                        safestrncpy(mid, mptr, sizeof mid);
                                else if (i == 'H')
@@ -1276,6 +1279,9 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                                }
                        }
                }
+               if (subject_found == 0) {
+                       cprintf("Subject: (no subject)%s", nl);
+               }
        }
 
        for (i=0; i<strlen(suser); ++i) {
@@ -1305,6 +1311,9 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                }
 
                cprintf("Organization: %s%s", lnode, nl);
+
+               /* Blank line signifying RFC822 end-of-headers */
+               cprintf("%s", nl);
        }
 
        /* end header processing loop ... at this point, we're in the text */
@@ -1345,12 +1354,6 @@ START_TEXT:
        if ( (mode == MT_CITADEL) || (mode == MT_MIME) ) {
                if (do_proto) cprintf("text\n");
        }
-       if (mode == MT_RFC822) {
-               if (TheMessage->cm_fields['U'] == NULL) {
-                       cprintf("Subject: (no subject)%s", nl);
-               }
-               cprintf("%s", nl);
-       }
 
        /* If the format type on disk is 1 (fixed-format), then we want
         * everything to be output completely literally ... regardless of