From 24e403ac8e70f919d5fe2befde73407ce18ecb80 Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Wed, 16 Feb 2000 00:53:43 +0000 Subject: [PATCH] more work for logon referral, r=mscott (+ backout inadvertent checkin to nsImapMailFolder.cpp --- mailnews/imap/src/nsImapIncomingServer.cpp | 19 ++++++++++++++----- mailnews/imap/src/nsImapIncomingServer.h | 2 +- mailnews/imap/src/nsImapMailFolder.cpp | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mailnews/imap/src/nsImapIncomingServer.cpp b/mailnews/imap/src/nsImapIncomingServer.cpp index f5ad79deca20..b1dedf449369 100644 --- a/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mailnews/imap/src/nsImapIncomingServer.cpp @@ -397,11 +397,12 @@ nsImapIncomingServer::CreateImapConnection(nsIEventQueue *aEventQueue, nsCOMPtr freeConnection; PRBool isBusy = PR_FALSE; PRBool isInboxConnection = PR_FALSE; - PRBool isAOLServer = PR_FALSE; + nsXPIDLCString redirectorType; PR_CEnterMonitor(this); - GetIsAOLServer(&isAOLServer); + GetRedirectorType(getter_Copies(redirectorType)); + PRBool redirectLogon = ((const char *) redirectorType && nsCRT::strlen((const char *) redirectorType) > 0); PRInt32 maxConnections = 5; // default to be five rv = GetMaximumConnectionsNumber(&maxConnections); @@ -448,7 +449,7 @@ nsImapIncomingServer::CreateImapConnection(nsIEventQueue *aEventQueue, if (ConnectionTimeOut(freeConnection)) freeConnection = null_nsCOMPtr(); - if (isAOLServer && (!connection || !canRunUrl)) + if (redirectLogon && (!connection || !canRunUrl)) { // here's where we'd start the asynchronous process of requesting a connection to the // AOL Imap server and getting back an ip address, port #, and cookie. @@ -457,7 +458,12 @@ nsImapIncomingServer::CreateImapConnection(nsIEventQueue *aEventQueue, if (!m_waitingForConnectionInfo) { m_waitingForConnectionInfo = PR_TRUE; - RequestOverrideInfo(); + nsCOMPtr mailnewsUrl = do_QueryInterface(aImapUrl, &rv); + nsCOMPtr aMsgWindow; + if (NS_SUCCEEDED(rv)) + rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(aMsgWindow)); + + RequestOverrideInfo(aMsgWindow); hasToWait = PR_TRUE; } } @@ -1551,7 +1557,7 @@ NS_IMETHODIMP nsImapIncomingServer::CreatePRUnicharStringFromUTF7(const char * a return CreateUnicodeStringFromUtf7(aSourceString, aUnicodeStr); } -nsresult nsImapIncomingServer::RequestOverrideInfo() +nsresult nsImapIncomingServer::RequestOverrideInfo(nsIMsgWindow *aMsgWindow) { nsresult rv; @@ -1574,6 +1580,9 @@ nsresult nsImapIncomingServer::RequestOverrideInfo() GetUsername(getter_Copies(userName)); GetPassword(getter_Copies(password)); + + if (!((const char *) password) || nsCRT::strlen((const char *) password) == 0) + PromptForPassword(getter_Copies(password), aMsgWindow); rv = redirector->Logon(userName, password, logonRedirectorRequester); } } diff --git a/mailnews/imap/src/nsImapIncomingServer.h b/mailnews/imap/src/nsImapIncomingServer.h index 00aa4983ce93..5419a36d2096 100644 --- a/mailnews/imap/src/nsImapIncomingServer.h +++ b/mailnews/imap/src/nsImapIncomingServer.h @@ -70,7 +70,7 @@ private: nsIImapProtocol** aImapConnection); nsresult CreateProtocolInstance(nsIEventQueue *aEventQueue, nsIImapProtocol ** aImapConnection); - nsresult RequestOverrideInfo(); + nsresult RequestOverrideInfo(nsIMsgWindow *aMsgWindow); PRBool ConnectionTimeOut(nsIImapProtocol* aImapConnection); nsCOMPtr m_connectionCache; diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index c3bfdf0c13b9..3284af510d80 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -317,7 +317,7 @@ nsresult nsImapMailFolder::CreateSubFolders(nsFileSpec &path) nsCOMPtr curFolder; // don't strip off the .msf in currentFolderPath. -// currentFolderPath.SetLeafName(currentFolderNameStr); + currentFolderPath.SetLeafName(currentFolderNameStr); rv = NS_NewFileSpecWithSpec(currentFolderPath, getter_AddRefs(curFolder)); currentFolderDBNameStr = currentFolderNameStr;