diff --git a/mailnews/base/public/msgCore.h b/mailnews/base/public/msgCore.h index 0e8927e7006..a639de54790 100644 --- a/mailnews/base/public/msgCore.h +++ b/mailnews/base/public/msgCore.h @@ -105,6 +105,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value) #define NS_MSG_FAILED(err) \ (NS_IS_MSG_ERROR(err) && NS_FAILED(err)) +#define NS_MSG_PASSWORD_PROMPT_CANCELLED NS_MSG_GENERATE_SUCCESS(1) + /* is this where we define our errors? Obviously, there has to be a central place so we don't use the same error codes. */ diff --git a/mailnews/imap/src/nsImapIncomingServer.cpp b/mailnews/imap/src/nsImapIncomingServer.cpp index 4dde235d256..b53d272aed0 100644 --- a/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mailnews/imap/src/nsImapIncomingServer.cpp @@ -2218,7 +2218,7 @@ NS_IMETHODIMP nsImapIncomingServer::PromptForPassword(char ** aPassword, nsresult rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow, &okayValue, aPassword); nsTextFormatter::smprintf_free(passwordText); - return rv; + return (okayValue) ? rv : NS_MSG_PASSWORD_PROMPT_CANCELLED; } // for the nsIImapServerSink interface diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index a9436fb848c..78390a52461 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -6564,7 +6564,9 @@ PRBool nsImapProtocol::TryToLogon() rv = GetMsgWindow(getter_AddRefs(aMsgWindow)); if (NS_FAILED(rv)) return rv; } - m_imapServerSink->PromptForPassword(getter_Copies(password), aMsgWindow); + rv = m_imapServerSink->PromptForPassword(getter_Copies(password), aMsgWindow); + if (rv == NS_MSG_PASSWORD_PROMPT_CANCELLED) + break; } PRBool imapPasswordIsNew = PR_FALSE;