* fix convert_internet_message_buf(); we forgot to append a newline here
authorWilfried Göesgens <willi@citadel.org>
Sat, 6 Mar 2010 12:56:21 +0000 (12:56 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 6 Mar 2010 12:56:21 +0000 (12:56 +0000)
* calculate the body start pos while iterating, so we can react the same way we did before

citadel/internet_addressing.c
citadel/msgbase.c

index ce8337f859bde64855d9ba0799f15937755f9dab..5f3a8b5c994cfb55dc614ebffd3a119033999660 100644 (file)
@@ -798,6 +798,7 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822)
                /* Strip the field out of the RFC822 header if we used it */
                if (!converted) {
                        StrBufAppendBufPlain(OtherHeaders, beg, end - beg, 0);
+                       StrBufAppendBufPlain(OtherHeaders, HKEY("\n"), 0);
                }
 
                /* If we've hit the end of the message, bail out */
index 98510111a8ff51f0d365914409b94594c236ad8a..70b368f29025ef059406699387fd5536ef69ec96 100644 (file)
@@ -2049,11 +2049,12 @@ START_TEXT:
                }
                else if (mode == MT_RFC822) {   /* unparsed RFC822 dump */
                        int eoh = 0;
+                       const char *StartOfText = StrBufNOTNULL;
 
                        char outbuf[1024];
                        int outlen = 0;
                        int nllen = strlen(nl);
-                       prev_ch = 0;
+                       prev_ch = '\0';
                        while (*mptr != '\0') {
                                if (*mptr == '\r') {
                                        /* do nothing */
@@ -2065,12 +2066,17 @@ START_TEXT:
                                                eoh = (*(mptr+1) == '\r') && (*(mptr+2) == '\n');
                                                if (!eoh)
                                                        eoh = *(mptr+1) == '\n';
+                                               if (eoh)
+                                               {
+                                                       StartOfText = mptr;
+                                                       StartOfText = strchr(StartOfText, '\n');
+                                                       StartOfText = strchr(StartOfText, '\n');
+                                               }
                                        }
-
-                                       if (
-                                               ((headers_only == HEADERS_NONE) && (eoh))
-                                          ||   ((headers_only == HEADERS_ONLY) && (!eoh))
-                                          ||   ((headers_only != HEADERS_NONE) && (headers_only != HEADERS_ONLY))
+                                       if (((headers_only == HEADERS_NONE) && (mptr >= StartOfText)) ||
+                                           ((headers_only == HEADERS_ONLY) && (mptr < StartOfText)) ||
+                                           ((headers_only != HEADERS_NONE) && 
+                                            (headers_only != HEADERS_ONLY))
                                        ) {
                                                if (*mptr == '\n') {
                                                        memcpy(&outbuf[outlen], nl, nllen);
@@ -2084,12 +2090,14 @@ START_TEXT:
                                }
                                if (flags & ESC_DOT)
                                {
-                                       if ((prev_ch == '\n') && (*mptr == '.') && ((*(mptr+1) == '\r') || (*(mptr+1) == '\n')))
+                                       if ((prev_ch == '\n') && 
+                                           (*mptr == '.') && 
+                                           ((*(mptr+1) == '\r') || (*(mptr+1) == '\n')))
                                        {
                                                outbuf[outlen++] = '.';
                                        }
+                                       prev_ch = *mptr;
                                }
-                               prev_ch = *mptr;
                                ++mptr;
                                if (outlen > 1000) {
                                        client_write(outbuf, outlen);