From 4414bfd19cac3cc7fab42322b78d357c43634cfb Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Thu, 29 Aug 2002 23:51:43 +0000 Subject: [PATCH] fix problems parsing certain imap headers with new hdr downloading code, r/sr=sspitzer, 19552 --- mailnews/imap/src/nsImapProtocol.cpp | 4 ++++ mailnews/imap/src/nsImapServerResponseParser.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 9037381540e..e885da1adcc 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -89,6 +89,7 @@ #include "nsIWindowMediator.h" #include "nsIWindowWatcher.h" #include "nsCOMPtr.h" +#include "nsMimeTypes.h" PRLogModuleInfo *IMAP; // netlib required files @@ -3171,6 +3172,8 @@ void nsImapProtocol::HandleMessageDownLoadLine(const char *line, PRBool chunkEnd if (GetServerStateParser().GetDownloadingHeaders()) { + if (!m_curHdrInfo) + BeginMessageDownLoad(GetServerStateParser().SizeOfMostRecentMessage(), MESSAGE_RFC822); m_curHdrInfo->CacheLine(localMessageLine, GetServerStateParser().CurrentResponseUID()); PR_Free( localMessageLine); return; @@ -3225,6 +3228,7 @@ void nsImapProtocol::NormalMessageEndDownload() AdjustChunkSize(); if (m_imapMailFolderSink && GetServerStateParser().GetDownloadingHeaders()) { + m_curHdrInfo->SetMsgSize(GetServerStateParser().SizeOfMostRecentMessage()); m_hdrDownloadCache.FinishCurrentHdr(); PRUint32 numHdrsCached; m_hdrDownloadCache.GetNumHeaders(&numHdrsCached); diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp index 26694e2fbea..78f4cdfc3ed 100644 --- a/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -1220,12 +1220,19 @@ void nsImapServerResponseParser::msg_fetch() envelope_data(); } else if (!PL_strcasecmp(fNextToken, "INTERNALDATE")) + { + fDownloadingHeaders = PR_TRUE; // we only request internal date while downloading headers + if (!bNeedEndMessageDownload) + BeginMessageDownload(MESSAGE_RFC822); + bNeedEndMessageDownload = PR_TRUE; internal_date(); + } else if (!PL_strcasecmp(fNextToken, "XAOL-ENVELOPE")) { fDownloadingHeaders = PR_TRUE; - bNeedEndMessageDownload = PR_TRUE; + if (!bNeedEndMessageDownload) BeginMessageDownload(MESSAGE_RFC822); + bNeedEndMessageDownload = PR_TRUE; xaolenvelope_data(); } else