From: Wilfried Göesgens Date: Sat, 6 Mar 2010 12:56:21 +0000 (+0000) Subject: * fix convert_internet_message_buf(); we forgot to append a newline here X-Git-Tag: v7.86~335 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=7713fe4c844c81903a7a1a36700117f4e6450d8b * fix convert_internet_message_buf(); we forgot to append a newline here * calculate the body start pos while iterating, so we can react the same way we did before --- diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index ce8337f85..5f3a8b5c9 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -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 */ diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 98510111a..70b368f29 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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);