зеркало из https://github.com/mozilla/gecko-dev.git
fix 324467 fix filtering on pop3 message body when message quarantining turned on, sr=mscott
This commit is contained in:
Родитель
9b8c094b16
Коммит
77491bb14e
|
@ -53,7 +53,7 @@ interface nsIOutputStream;
|
|||
|
||||
typedef long nsMsgFilterFileAttribValue;
|
||||
|
||||
[scriptable, uuid(08ecbcb4-0493-11d3-a50a-0060b0fc04b7)]
|
||||
[scriptable, uuid(ab0105ad-86bf-4862-9adb-84f4e266577c)]
|
||||
interface nsIMsgFilterList : nsISupports {
|
||||
|
||||
const nsMsgFilterFileAttribValue attribNone = 0;
|
||||
|
@ -112,7 +112,8 @@ interface nsIMsgFilterList : nsISupports {
|
|||
//[array, size_is(headerSize)] in string headers,
|
||||
in unsigned long headerSize,
|
||||
in nsIMsgFilterHitNotify listener,
|
||||
in nsIMsgWindow msgWindow);
|
||||
in nsIMsgWindow msgWindow,
|
||||
in nsILocalFile aMessageFile);
|
||||
|
||||
// IO routines, used by filter object filing code.
|
||||
void writeIntAttr(in nsMsgFilterFileAttribValue attrib, in long value, in nsIOFileStream stream);
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
nsCOMPtr <nsIMsgFolder> m_folder;
|
||||
nsCOMPtr <nsIMsgSearchAdapter> m_adapter;
|
||||
nsCOMPtr <nsIInputStream> m_inputStream; // for message bodies
|
||||
nsCOMPtr <nsILocalFile> m_localFile; // if set, input stream comes from this
|
||||
nsWeakPtr m_searchSession;
|
||||
PRBool m_searchServer;
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsMsgLocalSearch.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsMsgSearchValue.h"
|
||||
|
@ -505,19 +504,17 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgRuleAction *aFilterAction, nsIMsgDBH
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder, nsIMsgDatabase *db,
|
||||
const char *headers, PRUint32 headersSize, PRBool *pResult)
|
||||
NS_IMETHODIMP
|
||||
nsMsgFilter::MatchHdr(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder,
|
||||
nsIMsgDatabase *db, const char *headers,
|
||||
PRUint32 headersSize, PRBool *pResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(folder);
|
||||
// use offlineMail because
|
||||
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
|
||||
if (!scope) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsXPIDLCString folderCharset;
|
||||
folder->GetCharset(getter_Copies(folderCharset));
|
||||
nsresult rv = nsMsgSearchOfflineMail::MatchTermsForFilter(msgHdr, m_termList,
|
||||
folderCharset.get(), scope, db, headers, headersSize, &m_expressionTree, pResult);
|
||||
delete scope;
|
||||
folderCharset.get(), m_scope, db, headers, headersSize, &m_expressionTree, pResult);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIImportService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgFilterService.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
|
@ -303,13 +304,20 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
|||
const char *headers,
|
||||
PRUint32 headersSize,
|
||||
nsIMsgFilterHitNotify *listener,
|
||||
nsIMsgWindow *msgWindow)
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsILocalFile *aMessageFile)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFilter> filter;
|
||||
PRUint32 filterCount = 0;
|
||||
nsresult rv = GetFilterCount(&filterCount);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
|
||||
scope->AddRef();
|
||||
if (!scope) return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (aMessageFile)
|
||||
scope->m_localFile = aMessageFile;
|
||||
|
||||
for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
|
||||
{
|
||||
if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
|
||||
|
@ -327,7 +335,9 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
|||
nsresult matchTermStatus = NS_OK;
|
||||
PRBool result;
|
||||
|
||||
filter->SetScope(scope);
|
||||
matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
|
||||
filter->SetScope(nsnull);
|
||||
if (NS_SUCCEEDED(matchTermStatus) && result && listener)
|
||||
{
|
||||
PRBool applyMore = PR_TRUE;
|
||||
|
@ -339,6 +349,7 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
|
|||
}
|
||||
}
|
||||
}
|
||||
scope->Release();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -1458,15 +1458,23 @@ nsMsgSearchScopeTerm::GetSearchSession(nsIMsgSearchSession** aResult)
|
|||
NS_IMETHODIMP nsMsgSearchScopeTerm::GetMailFile(nsILocalFile **aLocalFile)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLocalFile);
|
||||
if (!m_folder)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (!m_localFile)
|
||||
{
|
||||
if (!m_folder)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr <nsIFileSpec> fileSpec;
|
||||
m_folder->GetPath(getter_AddRefs(fileSpec));
|
||||
nsFileSpec realSpec;
|
||||
fileSpec->GetFileSpec(&realSpec);
|
||||
NS_FileSpecToIFile(&realSpec, aLocalFile);
|
||||
return (*aLocalFile) ? NS_OK : NS_ERROR_FAILURE;
|
||||
nsCOMPtr <nsIFileSpec> fileSpec;
|
||||
m_folder->GetPath(getter_AddRefs(fileSpec));
|
||||
nsFileSpec realSpec;
|
||||
fileSpec->GetFileSpec(&realSpec);
|
||||
NS_FileSpecToIFile(&realSpec, getter_AddRefs(m_localFile));
|
||||
}
|
||||
if (m_localFile)
|
||||
{
|
||||
NS_ADDREF(*aLocalFile = m_localFile);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgSearchScopeTerm::GetInputStream(nsIInputStream **aInputStream)
|
||||
|
|
|
@ -3058,7 +3058,7 @@ nsresult nsImapMailFolder::NormalEndHeaderParseStream(nsIImapProtocol *aProtocol
|
|||
{
|
||||
GetMoveCoalescer(); // not sure why we're doing this here.
|
||||
m_filterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule, newMsgHdr, this, mDatabase,
|
||||
headers, headersSize, this, msgWindow);
|
||||
headers, headersSize, this, msgWindow, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1719,13 +1719,16 @@ void nsParseNewMailState::ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow,
|
|||
char * headers = m_headers.GetBuffer();
|
||||
PRUint32 headersSize = m_headers.GetBufferPos();
|
||||
nsresult matchTermStatus;
|
||||
// get nsILocalFile from m_inboxFileSpec
|
||||
nsCOMPtr <nsILocalFile> localFile;
|
||||
NS_FileSpecToIFile(&m_inboxFileSpec, getter_AddRefs(localFile));
|
||||
if (m_filterList)
|
||||
matchTermStatus = m_filterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule,
|
||||
msgHdr, downloadFolder, m_mailDB, headers, headersSize, this, msgWindow);
|
||||
msgHdr, downloadFolder, m_mailDB, headers, headersSize, this, msgWindow, localFile);
|
||||
if (!m_msgMovedByFilter && m_deferredToServerFilterList)
|
||||
{
|
||||
matchTermStatus = m_deferredToServerFilterList->ApplyFiltersToHdr(nsMsgFilterType::InboxRule,
|
||||
msgHdr, downloadFolder, m_mailDB, headers, headersSize, this, msgWindow);
|
||||
msgHdr, downloadFolder, m_mailDB, headers, headersSize, this, msgWindow, localFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,8 @@ public:
|
|||
nsresult AppendMsgFromFile(nsIOFileStream *fileStream, PRInt32 offset,
|
||||
PRUint32 length, nsFileSpec &destFileSpec);
|
||||
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow, PRUint32 msgOffset);
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow,
|
||||
PRUint32 msgOffset);
|
||||
nsresult ApplyForwardAndReplyFilter(nsIMsgWindow *msgWindow);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -808,7 +808,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
|
||||
m_outFileStream->Open(m_tmpDownloadFileSpec, (PR_RDWR | PR_CREATE_FILE));
|
||||
|
||||
hdr->SetMessageKey(0);
|
||||
m_newMailParser->ApplyFilters(&moved, aMsgWindow, 0);
|
||||
if (!moved)
|
||||
{
|
||||
|
|
|
@ -691,12 +691,12 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
if (filterCount)
|
||||
{
|
||||
rv = m_filterList->ApplyFiltersToHdr(nsMsgFilterType::NewsRule, newMsgHdr, folder, m_newsDB,
|
||||
headers, headersSize, this, m_msgWindow);
|
||||
headers, headersSize, this, m_msgWindow, nsnull);
|
||||
}
|
||||
if (serverFilterCount)
|
||||
{
|
||||
rv = m_serverFilterList->ApplyFiltersToHdr(nsMsgFilterType::NewsRule, newMsgHdr, folder, m_newsDB,
|
||||
headers, headersSize, this, m_msgWindow);
|
||||
headers, headersSize, this, m_msgWindow, nsnull);
|
||||
}
|
||||
|
||||
PR_Free ((void*) headers);
|
||||
|
|
Загрузка…
Ссылка в новой задаче