fix crash after downloading pop3 mail with message quarantining turned on, sr=mscott 332700

This commit is contained in:
bienvenu%nventure.com 2006-06-22 14:25:16 +00:00
Родитель 4747b6b35f
Коммит b54b56c13c
4 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -3791,7 +3791,7 @@ nsMsgLocalMailFolder::AddMessage(const char *aMessage)
rv = newMailParser->Init(rootFolder, this,
fileSpec, &outFileStream, nsnull);
fileSpec, &outFileStream, nsnull, PR_FALSE);
if (NS_SUCCEEDED(rv))
{

Просмотреть файл

@ -1499,7 +1499,9 @@ nsParseNewMailState::nsParseNewMailState()
NS_IMPL_ISUPPORTS_INHERITED1(nsParseNewMailState, nsMsgMailboxParser, nsIMsgFilterHitNotify)
nsresult
nsParseNewMailState::Init(nsIMsgFolder *serverFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow)
nsParseNewMailState::Init(nsIMsgFolder *serverFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder,
nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow,
PRBool downloadingToTempFile)
{
nsresult rv;
m_position = folder.GetFileSize();
@ -1508,6 +1510,7 @@ nsParseNewMailState::Init(nsIMsgFolder *serverFolder, nsIMsgFolder *downloadFold
m_inboxFileStream = inboxFileStream;
m_msgWindow = aMsgWindow;
m_downloadFolder = downloadFolder;
m_downloadingToTempFile = downloadingToTempFile;
// the new mail parser isn't going to get the stream input, it seems, so we can't use
// the OnStartRequest mechanism the mailbox parser uses. So, let's open the db right now.
@ -1842,6 +1845,11 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
{
if (loggingEnabled)
(void)filter->LogRuleHit(filterAction, msgHdr);
// if we're downloading to a temp file, our message key is wrong,
// i.e., relative to the temp file and not the original mailbox,
// and we need to let nsPop3Sink remove the message hdr after
// it fixes the key.
if (!m_downloadingToTempFile)
m_mailDB->RemoveHeaderMdbRow(msgHdr);
}
}

Просмотреть файл

@ -233,7 +233,9 @@ public:
nsParseNewMailState();
virtual ~nsParseNewMailState();
NS_DECL_ISUPPORTS_INHERITED
nsresult Init(nsIMsgFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow);
nsresult Init(nsIMsgFolder *rootFolder, nsIMsgFolder *downloadFolder, nsFileSpec &folder,
nsIOFileStream *inboxFileStream, nsIMsgWindow *aMsgWindow,
PRBool downloadingToTempFile);
virtual void DoneParsingFolder(nsresult status);
@ -276,6 +278,7 @@ protected:
nsIOFileStream *m_inboxFileStream;
nsFileSpec m_inboxFileSpec;
PRBool m_disableFilters;
PRBool m_downloadingToTempFile;
PRUint32 m_ibuffer_fp;
char *m_ibuffer;
PRUint32 m_ibuffer_size;

Просмотреть файл

@ -353,7 +353,8 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
rv = GetServerFolder(getter_AddRefs(serverFolder));
if (NS_FAILED(rv)) return rv;
rv = m_newMailParser->Init(serverFolder, m_folder, (m_downloadingToTempFile) ? m_tmpDownloadFileSpec : fileSpec, m_outFileStream, aMsgWindow);
rv = m_newMailParser->Init(serverFolder, m_folder, (m_downloadingToTempFile) ? m_tmpDownloadFileSpec : fileSpec,
m_outFileStream, aMsgWindow, m_downloadingToTempFile);
// if we failed to initialize the parser, then just don't use it!!!
// we can still continue without one...
@ -871,8 +872,8 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
{
nsFileSpec destFolderSpec;
nsCOMPtr<nsIFileSpec> path;
// nsParseNewMailState::ApplyFilterHit already removed the hdr from the db
// so we don't have to.
// cleanup after mailHdr in source DB because we moved the message.
m_newMailParser->m_mailDB->RemoveHeaderMdbRow(hdr);
// if the filter moved the message, it called nsParseMailMessageState::Init
// to truncate the source folder, which resets m_envelopePos and m_position.