Bug #122236 --> set the performing biff flag when we are about to perform biff

and register the root folder as a listener on the url so it can clear the flag

Bug #123440 --> don't give a message window when performing biff, this keeps
biff from bringing up any form of UI.
r=naving
sr=bienvenu
This commit is contained in:
mscott%netscape.com 2002-02-05 01:36:15 +00:00
parent f5490bd919
commit 90f007dec7
2 changed files with 35 additions and 11 deletions

View File

@ -70,7 +70,6 @@
#include "nsLocalUtils.h"
#include "nsIPop3IncomingServer.h"
#include "nsILocalMailIncomingServer.h"
#include "nsIPop3Service.h"
#include "nsIMsgIncomingServer.h"
#include "nsMsgBaseCID.h"
#include "nsMsgLocalCID.h"
@ -97,11 +96,11 @@
#include "nsNetCID.h"
#include "nsEscape.h"
#include "nsLocalStringBundle.h"
#include "nsIMsgMailNewsUrl.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kMailboxServiceCID, NS_MAILBOXSERVICE_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
static NS_DEFINE_CID(kCopyMessageStreamListenerCID, NS_COPYMESSAGESTREAMLISTENER_CID);
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
@ -3138,6 +3137,7 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
nsXPIDLCString aSpec;
aUrl->GetSpec(getter_Copies(aSpec));
if (PL_strstr(aSpec, "uidl="))
{
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
@ -3171,18 +3171,37 @@ nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
}
}
}
if (mDatabase && (mFlags & MSG_FOLDER_FLAG_INBOX))
if (mFlags & MSG_FOLDER_FLAG_INBOX)
{
PRBool valid;
mDatabase->GetSummaryValid(&valid);
if (valid && mCheckForNewMessagesAfterParsing)
// if we are the inbox,
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aUrl);
if (mailnewsUrl)
{
if (msgWindow)
nsCOMPtr<nsIMsgWindow> msgWindow;
mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
if (!msgWindow) // if we don't have a message window, we are probably performing biff
{
nsCOMPtr<nsIMsgIncomingServer> server;
GetServer(getter_AddRefs(server));
if (server)
server->SetPerformingBiff(PR_FALSE);
}
}
if (mDatabase)
{
PRBool valid;
mDatabase->GetSummaryValid(&valid);
if (valid && mCheckForNewMessagesAfterParsing)
{
if (msgWindow)
rv = GetNewMessages(msgWindow, nsnull);
mCheckForNewMessagesAfterParsing = PR_FALSE;
mCheckForNewMessagesAfterParsing = PR_FALSE;
}
}
}
}
return nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
}

View File

@ -182,6 +182,7 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
nsCOMPtr<nsIMsgFolder> inbox;
nsCOMPtr<nsIMsgFolder> rootMsgFolder;
nsCOMPtr<nsIUrlListener> urlListener;
rv = GetRootMsgFolder(getter_AddRefs(rootMsgFolder));
if(NS_SUCCEEDED(rv) && rootMsgFolder)
{
@ -201,6 +202,9 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_SUCCEEDED(rv))
{
SetPerformingBiff(PR_TRUE);
urlListener = do_QueryInterface(inbox);
PRBool downloadOnBiff = PR_FALSE;
rv = GetDownloadOnBiff(&downloadOnBiff);
if (downloadOnBiff)
@ -213,15 +217,16 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
rv = inbox->GetMsgDatabase(msgWindow, getter_AddRefs(db));
if (NS_SUCCEEDED(rv) && db)
rv = db->GetSummaryValid(&valid);
// it's important to pass in null for the msg window if we are performing biff
// this makes sure that we don't show any kind of UI during biff.
if (NS_SUCCEEDED(rv) && valid)
rv = pop3Service->GetNewMail(msgWindow, nsnull, inbox, this, nsnull);
rv = pop3Service->GetNewMail(nsnull, urlListener, inbox, this, nsnull);
else
rv = localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
}
}
else
rv = pop3Service->CheckForNewMail(msgWindow, nsnull, inbox, this,
nsnull);
rv = pop3Service->CheckForNewMail(nsnull, urlListener, inbox, this, nsnull);
}
return NS_OK;
}