Fix for 205729. Added 'aMsgWindow' input parameter to PerformBiff() which is set to null for regular biff (ie, check mail for every xx minutes) and is set to a valid window for check mail at startup. r=sspitzer, sr=bienvenu, a=sspitzer.

This commit is contained in:
cavin%netscape.com 2003-05-19 23:59:06 +00:00
Родитель f2e4ea223f
Коммит 72f75498c9
11 изменённых файлов: 37 добавлений и 47 удалений

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

@ -189,7 +189,7 @@ interface nsIMsgIncomingServer : nsISupports {
void SetDefaultLocalPath(in nsIFileSpec aDefaultLocalPath);
/* do a biff */
void PerformBiff();
void PerformBiff(in nsIMsgWindow aMsgWindow);
/* this checks if a server needs a password to do biff */
readonly attribute boolean serverRequiresPasswordForBiff;

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

@ -749,7 +749,7 @@ function MsgGetMessagesForAllServers(defaultServer)
else
{
// Check to see if there are new messages on the server
currentServer.PerformBiff();
currentServer.PerformBiff(msgWindow);
}
}
}

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

@ -788,7 +788,7 @@ function loadStartFolder(initialUri)
{
// Perform biff on the server to check for new mail, except for imap
if (defaultServer.type != "imap")
defaultServer.PerformBiff();
defaultServer.PerformBiff(msgWindow);
}

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

@ -335,7 +335,7 @@ nsresult nsMsgBiffManager::PerformBiff()
// (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 || userAuthenticated))
current->server->PerformBiff();
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);

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

@ -173,7 +173,7 @@ nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
NS_IMETHODIMP
nsMsgIncomingServer::PerformBiff()
nsMsgIncomingServer::PerformBiff(nsIMsgWindow* aMsgWindow)
{
//This had to be implemented in the derived class, but in case someone doesn't implement it
//just return not implemented.

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

@ -948,7 +948,7 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
return rv;
}
NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
NS_IMETHODIMP nsImapIncomingServer::PerformBiff(nsIMsgWindow* aMsgWindow)
{
nsresult rv;
@ -957,7 +957,7 @@ NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
if(NS_SUCCEEDED(rv))
{
SetPerformingBiff(PR_TRUE);
rv = rootMsgFolder->GetNewMessages(nsnull, nsnull);
rv = rootMsgFolder->GetNewMessages(aMsgWindow, nsnull);
}
return rv;
}

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

@ -75,7 +75,7 @@ public:
NS_DECL_NSISUBSCRIBABLESERVER
NS_DECL_NSIURLLISTENER
NS_IMETHOD PerformBiff();
NS_IMETHOD PerformBiff(nsIMsgWindow *aMsgWindow);
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
NS_IMETHOD CloseCachedConnections();
NS_IMETHOD GetConstructedPrettyName(PRUnichar **retval);

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

@ -53,7 +53,6 @@
#include "nsMsgFolderFlags.h"
#include "nsIFileSpec.h"
#include "nsPop3Protocol.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgLocalMailFolder.h"
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
@ -120,7 +119,7 @@ nsPop3IncomingServer::GetLocalStoreType(char **type)
return NS_OK;
}
NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
NS_IMETHODIMP nsPop3IncomingServer::PerformBiff(nsIMsgWindow *aMsgWindow)
{
nsresult rv;
nsCOMPtr<nsIPop3Service> pop3Service(do_GetService(kCPop3ServiceCID, &rv));
@ -139,50 +138,41 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
if (NS_FAILED(rv) || numFolders != 1) return rv;
}
//Biff just needs to give status in one of the windows. so do it in topmost window.
nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgWindow> msgWindow;
SetPerformingBiff(PR_TRUE);
urlListener = do_QueryInterface(inbox);
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_SUCCEEDED(rv))
PRBool downloadOnBiff = PR_FALSE;
rv = GetDownloadOnBiff(&downloadOnBiff);
if (downloadOnBiff)
{
SetPerformingBiff(PR_TRUE);
urlListener = do_QueryInterface(inbox);
PRBool downloadOnBiff = PR_FALSE;
rv = GetDownloadOnBiff(&downloadOnBiff);
if (downloadOnBiff)
nsCOMPtr <nsIMsgLocalMailFolder> localInbox = do_QueryInterface(inbox, &rv);
if (localInbox && NS_SUCCEEDED(rv))
{
nsCOMPtr <nsIMsgLocalMailFolder> localInbox = do_QueryInterface(inbox, &rv);
if (localInbox && NS_SUCCEEDED(rv))
PRBool valid =PR_FALSE;
nsCOMPtr <nsIMsgDatabase> db;
rv = inbox->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
if (NS_SUCCEEDED(rv) && db)
rv = db->GetSummaryValid(&valid);
if (NS_SUCCEEDED(rv) && valid)
rv = pop3Service->GetNewMail(aMsgWindow, urlListener, inbox, this, nsnull);
else
{
PRBool valid =PR_FALSE;
nsCOMPtr <nsIMsgDatabase> db;
rv = inbox->GetMsgDatabase(msgWindow, getter_AddRefs(db));
if (NS_SUCCEEDED(rv) && db)
rv = db->GetSummaryValid(&valid);
if (NS_SUCCEEDED(rv) && valid)
rv = pop3Service->GetNewMail(msgWindow, urlListener, inbox, this, nsnull);
else
PRBool isLocked;
inbox->GetLocked(&isLocked);
if (!isLocked)
{
PRBool isLocked;
inbox->GetLocked(&isLocked);
if (!isLocked)
{
rv = localInbox->ParseFolder(msgWindow, urlListener);
}
if (NS_SUCCEEDED(rv))
rv = localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
rv = localInbox->ParseFolder(aMsgWindow, urlListener);
}
if (NS_SUCCEEDED(rv))
rv = localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
}
}
else
rv = pop3Service->CheckForNewMail(nsnull, urlListener, inbox, this, nsnull);
}
else
rv = pop3Service->CheckForNewMail(nsnull, urlListener, inbox, this, nsnull);
// 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.
}
return NS_OK;
}

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

@ -58,7 +58,7 @@ public:
virtual ~nsPop3IncomingServer();
NS_IMETHOD GetLocalStoreType(char **);
NS_IMETHOD PerformBiff();
NS_IMETHOD PerformBiff(nsIMsgWindow *aMsgWindow);
NS_IMETHOD GetDownloadMessagesAtStartup(PRBool *getMessages);
NS_IMETHOD GetCanBeDefaultServer(PRBool *canBeDefaultServer);
NS_IMETHOD GetCanSearchMessages(PRBool *canSearchMessages);

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

@ -699,7 +699,7 @@ nsNntpIncomingServer::DisplaySubscribedGroup(nsIMsgNewsFolder *aMsgFolder, PRInt
}
NS_IMETHODIMP
nsNntpIncomingServer::PerformBiff()
nsNntpIncomingServer::PerformBiff(nsIMsgWindow *aMsgWindow)
{
#ifdef DEBUG_NEWS
printf("PerformBiff for nntp\n");

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

@ -84,7 +84,7 @@ public:
NS_IMETHOD GetLocalStoreType(char * *type);
NS_IMETHOD CloseCachedConnections();
NS_IMETHOD PerformBiff();
NS_IMETHOD PerformBiff(nsIMsgWindow *aMsgWindow);
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
NS_IMETHOD GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult);
NS_IMETHOD OnUserOrHostNameChanged(const char *oldName, const char *newName);