зеркало из https://github.com/mozilla/pjs.git
fix imap not to download all msg headers r=naving, sr=sspitzer 137994
This commit is contained in:
Родитель
6f56cb346d
Коммит
8ef85eab23
|
@ -69,7 +69,7 @@ interface nsIMsgFilterList : nsISupports {
|
|||
attribute nsIMsgFolder folder;
|
||||
readonly attribute short version;
|
||||
readonly attribute string arbitraryHeaders;
|
||||
readonly attribute boolean shouldDownloadArbitraryHeaders;
|
||||
readonly attribute boolean shouldDownloadAllHeaders;
|
||||
readonly attribute unsigned long filterCount;
|
||||
nsIMsgFilter getFilterAt(in unsigned long filterIndex);
|
||||
nsIMsgFilter getFilterNamed(in wstring filterName);
|
||||
|
|
|
@ -985,7 +985,16 @@ NS_IMETHODIMP nsMsgFilterList::MatchOrChangeFilterTarget(const char *oldFolderUr
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilterList::GetShouldDownloadArbitraryHeaders(PRBool *aResult)
|
||||
// this would only return true if any filter was on "any header", which we
|
||||
// don't support in 6.x
|
||||
NS_IMETHODIMP nsMsgFilterList::GetShouldDownloadAllHeaders(PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// leaves m_arbitraryHeaders filed in with the arbitrary headers.
|
||||
nsresult nsMsgFilterList::ComputeArbitraryHeaders()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (m_arbitraryHeaders.Length() == 0)
|
||||
|
@ -1025,17 +1034,13 @@ NS_IMETHODIMP nsMsgFilterList::GetShouldDownloadArbitraryHeaders(PRBool *aResult
|
|||
}
|
||||
}
|
||||
}
|
||||
if (m_arbitraryHeaders.Length() > 0) //if any arbitraryHeaders;
|
||||
*aResult=PR_TRUE;
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilterList::GetArbitraryHeaders(char **aResult)
|
||||
{
|
||||
PRBool headers=PR_FALSE;
|
||||
GetShouldDownloadArbitraryHeaders(&headers);
|
||||
if (headers)
|
||||
*aResult = ToNewCString(m_arbitraryHeaders);
|
||||
ComputeArbitraryHeaders();
|
||||
*aResult = ToNewCString(m_arbitraryHeaders);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ protected:
|
|||
void Dump();
|
||||
#endif
|
||||
protected:
|
||||
nsresult ComputeArbitraryHeaders();
|
||||
nsresult SaveTextFilters(nsIOFileStream *aStream);
|
||||
// file streaming methods
|
||||
char ReadChar(nsIOFileStream *aStream);
|
||||
|
|
|
@ -289,6 +289,7 @@ nsMsgSearchTerm::nsMsgSearchTerm()
|
|||
m_value.string=nsnull;
|
||||
m_value.attribute=0;
|
||||
m_value.u.priority=0;
|
||||
m_attribute = nsMsgSearchAttrib::Default;
|
||||
}
|
||||
|
||||
nsMsgSearchTerm::nsMsgSearchTerm (
|
||||
|
|
|
@ -73,6 +73,6 @@ interface nsIImapServerSink : nsISupports {
|
|||
/* this is a bogus method on this interface but i need it until misc. sink is scriptable.. */
|
||||
void RemoveChannelFromUrl(in nsIMsgMailNewsUrl aUrl, in unsigned long statusCode);
|
||||
readonly attribute string arbitraryHeaders;
|
||||
readonly attribute boolean shouldDownloadArbitraryHeaders;
|
||||
readonly attribute boolean shouldDownloadAllHeaders;
|
||||
};
|
||||
|
||||
|
|
|
@ -3591,14 +3591,14 @@ nsImapIncomingServer::GetNewMessagesAllFolders(nsIMsgFolder *aRootFolder, nsIMsg
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetShouldDownloadArbitraryHeaders(PRBool *aResult)
|
||||
nsImapIncomingServer::GetShouldDownloadAllHeaders(PRBool *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK; //for now checking for filters is enough
|
||||
nsCOMPtr <nsIMsgFilterList> filterList; //later on we might have to check for MDN ;
|
||||
if (!mFilterList)
|
||||
GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
if (mFilterList)
|
||||
rv = mFilterList->GetShouldDownloadArbitraryHeaders(aResult);
|
||||
rv = mFilterList->GetShouldDownloadAllHeaders(aResult);
|
||||
else
|
||||
*aResult = PR_FALSE;
|
||||
return rv;
|
||||
|
|
|
@ -231,6 +231,7 @@ nsImapProtocol::nsImapProtocol() :
|
|||
m_flags = 0;
|
||||
m_urlInProgress = PR_FALSE;
|
||||
m_socketIsOpen = PR_FALSE;
|
||||
m_ignoreExpunges = PR_FALSE;
|
||||
m_gotFEEventCompletion = PR_FALSE;
|
||||
m_connectionStatus = 0;
|
||||
m_hostSessionList = nsnull;
|
||||
|
@ -600,7 +601,12 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
|
|||
GetServerStateParser().SetCapabilityFlag(capability);
|
||||
|
||||
if (imapServer)
|
||||
{
|
||||
nsXPIDLCString redirectorType;
|
||||
imapServer->GetRedirectorType(getter_Copies(redirectorType));
|
||||
m_ignoreExpunges = redirectorType.Equals("aol");
|
||||
imapServer->GetFetchByChunks(&m_fetchByChunks);
|
||||
}
|
||||
|
||||
if ( m_runningUrl && !m_channel /* and we don't have a transport yet */)
|
||||
{
|
||||
|
@ -2304,10 +2310,10 @@ nsresult nsImapProtocol::BeginMessageDownLoad(
|
|||
}
|
||||
|
||||
void
|
||||
nsImapProtocol::GetShouldDownloadArbitraryHeaders(PRBool *aResult)
|
||||
nsImapProtocol::GetShouldDownloadAllHeaders(PRBool *aResult)
|
||||
{
|
||||
if (m_imapServerSink)
|
||||
m_imapServerSink->GetShouldDownloadArbitraryHeaders(aResult);
|
||||
m_imapServerSink->GetShouldDownloadAllHeaders(aResult);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2576,21 +2582,20 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
|||
if (GetServerStateParser().ServerHasIMAP4Rev1Capability())
|
||||
{
|
||||
PRUint32 server_capabilityFlags = GetServerStateParser().GetCapabilityFlag();
|
||||
PRBool aolImapServer = ((server_capabilityFlags & kAOLImapCapability) != 0);
|
||||
PRBool useArbitraryHeaders = PR_FALSE;
|
||||
GetShouldDownloadArbitraryHeaders(&useArbitraryHeaders); // checks filter headers, etc.
|
||||
if (/***** Fix me *** gOptimizedHeaders && */// preference -- able to turn it off
|
||||
useArbitraryHeaders) // if it's ok -- no filters on any header, etc.
|
||||
PRBool aolImapServer = ((server_capabilityFlags & kAOLImapCapability) != 0);
|
||||
PRBool downloadAllHeaders = PR_FALSE; // we don't currently ever need to do this.
|
||||
// GetShouldDownloadAllHeaders(&downloadAllHeaders); // checks if we're filtering on "any header"
|
||||
if (!downloadAllHeaders) // if it's ok -- no filters on any header, etc.
|
||||
{
|
||||
char *headersToDL = nsnull;
|
||||
char *what = nsnull;
|
||||
const char *dbHeaders = (gUseEnvelopeCmd) ? IMAP_DB_HEADERS : IMAP_ENV_AND_DB_HEADERS;
|
||||
nsXPIDLCString arbitraryHeaders;
|
||||
GetArbitraryHeadersToDownload(getter_Copies(arbitraryHeaders));
|
||||
if (arbitraryHeaders)
|
||||
headersToDL = PR_smprintf("%s %s",dbHeaders, arbitraryHeaders.get());
|
||||
else
|
||||
if (arbitraryHeaders.IsEmpty())
|
||||
headersToDL = nsCRT::strdup(dbHeaders);
|
||||
else
|
||||
headersToDL = PR_smprintf("%s %s",dbHeaders, arbitraryHeaders.get());
|
||||
|
||||
if (aolImapServer)
|
||||
what = nsCRT::strdup(" XAOL-ENVELOPE INTERNALDATE)");
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
static void EscapeUserNamePasswordString(const char *strToEscape, nsCString *resultStr);
|
||||
|
||||
// used to start fetching a message.
|
||||
void GetShouldDownloadArbitraryHeaders(PRBool *aResult);
|
||||
void GetShouldDownloadAllHeaders(PRBool *aResult);
|
||||
void GetArbitraryHeadersToDownload(char **aResult);
|
||||
virtual void AdjustChunkSize();
|
||||
virtual void FetchMessage(const char * messageIds,
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
// Used for MIME parts on demand.
|
||||
void SetContentModified(IMAP_ContentModifiedType modified);
|
||||
PRBool GetShouldFetchAllParts();
|
||||
|
||||
PRBool GetIgnoreExpunges() {return m_ignoreExpunges;}
|
||||
// Generic accessors required by the imap parser
|
||||
char * CreateNewLineFromSocket();
|
||||
PRInt32 GetConnectionStatus();
|
||||
|
@ -544,6 +544,7 @@ private:
|
|||
PRInt32 m_chunkStartSize;
|
||||
PRInt32 m_maxChunkSize;
|
||||
PRBool m_fetchByChunks;
|
||||
PRBool m_ignoreExpunges;
|
||||
PRInt32 m_chunkSize;
|
||||
PRInt32 m_chunkThreshold;
|
||||
TLineDownloadCache m_downloadLineCache;
|
||||
|
|
Загрузка…
Ссылка в новой задаче