зеркало из https://github.com/mozilla/gecko-dev.git
fix multiple pop3 servers biffing at the same time with the global inbox, sr=mscott 268080
This commit is contained in:
Родитель
3f40b9f5bc
Коммит
06f71398ac
|
@ -42,6 +42,7 @@
|
|||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsStatusBarBiffManager.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
static NS_DEFINE_CID(kStatusBarBiffManagerCID, NS_STATUSBARBIFFMANAGER_CID);
|
||||
|
||||
|
@ -320,6 +321,8 @@ nsresult nsMsgBiffManager::SetupNextBiff()
|
|||
nsresult nsMsgBiffManager::PerformBiff()
|
||||
{
|
||||
nsTime currentTime;
|
||||
nsCOMArray <nsIMsgFolder> targetFolders;
|
||||
|
||||
for(PRInt32 i = 0; i < mBiffArray->Count(); i++)
|
||||
{
|
||||
nsBiffEntry *current = (nsBiffEntry*)mBiffArray->ElementAt(i);
|
||||
|
@ -328,18 +331,35 @@ nsresult nsMsgBiffManager::PerformBiff()
|
|||
PRBool serverBusy = PR_FALSE;
|
||||
PRBool serverRequiresPassword = PR_TRUE;
|
||||
PRBool passwordPromptRequired;
|
||||
|
||||
current->server->GetPasswordPromptRequired(&passwordPromptRequired);
|
||||
current->server->GetServerBusy(&serverBusy);
|
||||
current->server->GetServerRequiresPasswordForBiff(&serverRequiresPassword);
|
||||
// find the dest folder we're actually downloading to...
|
||||
nsCOMPtr<nsIMsgFolder> rootMsgFolder;
|
||||
current->server->GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
|
||||
PRInt32 targetFolderIndex = targetFolders.IndexOfObject(rootMsgFolder);
|
||||
if (targetFolderIndex == kNotFound)
|
||||
targetFolders.AppendObject(rootMsgFolder);
|
||||
|
||||
// so if we need to be authenticated to biff, check that we are
|
||||
// (since we don't want to prompt the user for password UI)
|
||||
// and make sure the server isn't already in the middle of downloading new messages
|
||||
if(!serverBusy && (!serverRequiresPassword || !passwordPromptRequired))
|
||||
if(!serverBusy && (!serverRequiresPassword || !passwordPromptRequired) && targetFolderIndex == kNotFound)
|
||||
current->server->PerformBiff(nsnull);
|
||||
mBiffArray->RemoveElementAt(i);
|
||||
i--; //Because we removed it we need to look at the one that just moved up.
|
||||
SetNextBiffTime(current, currentTime);
|
||||
AddBiffEntry(current);
|
||||
// if we didn't do this server because the destination server was already being
|
||||
// biffed into, leave this server in the biff array so it will fire next.
|
||||
if (targetFolderIndex == kNotFound)
|
||||
{
|
||||
mBiffArray->RemoveElementAt(i);
|
||||
i--; //Because we removed it we need to look at the one that just moved up.
|
||||
SetNextBiffTime(current, currentTime);
|
||||
AddBiffEntry(current);
|
||||
}
|
||||
#ifdef DEBUG_David_Bienvenu
|
||||
else
|
||||
printf("dest account performing biff\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
//since we're in biff order, there's no reason to keep checking
|
||||
|
|
|
@ -3178,9 +3178,9 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
mDownloadWindow = nsnull;
|
||||
return nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
|
||||
}
|
||||
nsresult rv;
|
||||
if (NS_SUCCEEDED(aExitCode))
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
|
@ -3188,52 +3188,24 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
nsCAutoString aSpec;
|
||||
aUrl->GetSpec(aSpec);
|
||||
|
||||
if (strstr(aSpec.get(), "uidl="))
|
||||
if (strstr(aSpec.get(), "uidl=") && msgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLCString messageuri;
|
||||
rv = popurl->GetMessageUri(getter_Copies(messageuri));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIRDFService> rdfService =
|
||||
do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgDBHdr;
|
||||
rv = GetMsgDBHdrFromURI(messageuri, getter_AddRefs(msgDBHdr));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
rv = mDatabase->DeleteHeader(msgDBHdr, nsnull, PR_TRUE,
|
||||
PR_TRUE);
|
||||
nsCOMPtr<nsIPop3Sink> pop3sink;
|
||||
nsXPIDLCString newMessageUri;
|
||||
rv = popurl->GetPop3Sink(getter_AddRefs(pop3sink));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
pop3sink->GetMessageUri(getter_Copies(newMessageUri));
|
||||
if(msgWindow)
|
||||
{
|
||||
msgWindow->SelectMessage(newMessageUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX)
|
||||
{
|
||||
// if we are the inbox and running pop url
|
||||
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
GetServer(getter_AddRefs(server));
|
||||
// this is the deferred to account, in the global inbox case
|
||||
if (server)
|
||||
server->SetPerformingBiff(PR_FALSE); //biff is over
|
||||
}
|
||||
if (mDatabase)
|
||||
{
|
||||
if (mCheckForNewMessagesAfterParsing)
|
||||
|
@ -3256,6 +3228,19 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
mReparseListener->OnStopRunningUrl(aUrl, aExitCode);
|
||||
mReparseListener = nsnull;
|
||||
}
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX)
|
||||
{
|
||||
// if we are the inbox and running pop url
|
||||
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
GetServer(getter_AddRefs(server));
|
||||
// this is the deferred to account, in the global inbox case
|
||||
if (server)
|
||||
server->SetPerformingBiff(PR_FALSE); //biff is over
|
||||
}
|
||||
}
|
||||
m_parsingFolder = PR_FALSE;
|
||||
return nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче