fix #16457, r=mscott. if an error occurs in the SMTP protocol state machine, we may need to pop up the alert right then, and not when we get back to the url listener, because we'd loose the error text from the SMTP server. these changes
pop up the alert and set the error code so that the url listener doesn't try to pop up another alert. define a bunch of new error codes, and remove nsMsgTransition.h, which was defining all the MK_ error codes that were in there. are no longer needed. git-svn-id: svn://10.0.0.236/trunk@52602 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a95990ff7f
commit
baa984b1b1
@ -51,7 +51,7 @@
|
||||
12510=No sender was specified. Please fill in your email address in the Mail and Newsgroup preferences.
|
||||
|
||||
## @name NS_MSG_NO_RECIPIENTS
|
||||
12511=No recipients were specified. Please enter a recipient in a To: line, or a newsgroup in a Group: line..
|
||||
12511=No recipients were specified. Please enter a recipient in a To: line, or a newsgroup in a Newsgroup: line..
|
||||
|
||||
## @name NS_MSG_ERROR_WRITING_FILE
|
||||
12512=Error writing temporary file.
|
||||
@ -60,7 +60,7 @@
|
||||
12513=An error occurred sending mail: Unable to connect to the SMTP server. The server may be down or may be incorrectly configured. Please verify that your Mail preferences are correct and try again.
|
||||
|
||||
## @name NS_ERROR_SENDING_FROM_COMMAND
|
||||
12514=An error occurred while sending mail. The mail server responded: %s Please verify that your email address is correct in your Mail preferences and try again.
|
||||
12514=An error occurred while sending mail. The mail server responded: %s. Please verify that your email address is correct in your Mail preferences and try again.
|
||||
|
||||
## @name NS_ERROR_SENDING_RCPT_COMMAND
|
||||
12515=An error occurred while sending mail. The mail server responded: %s. Please check the message recipients and try again.
|
||||
@ -89,8 +89,26 @@
|
||||
## @name SMTP_PROGRESS_MAILSENT
|
||||
12523=Mail sent successfully
|
||||
|
||||
## @name SMTP_SERVER_ERROR
|
||||
## @name NS_ERROR_SMTP_SERVER_ERROR
|
||||
12524=An error occurred sending mail: SMTP server error. The server responded: %s Contact your mail administrator for assistance.
|
||||
|
||||
## @name NS_MSG_UNABLE_TO_SEND_LATER
|
||||
12525=Unable to save your message in order to send it later. Please verify that your Mail preferences are correct and try again.
|
||||
|
||||
## @name NS_ERROR_COMMUNICATIONS_ERROR
|
||||
12526=A communications error occurred: %d. Please try again.
|
||||
|
||||
## @name NS_ERROR_BUT_DONT_SHOW_ALERT
|
||||
12527=THIS IS JUST A PLACEHOLDER. YOU SHOULD NEVER SEE THIS STRING.
|
||||
|
||||
## @name NS_ERROR_TCP_READ_ERROR
|
||||
12528=A network error occurred while Mozilla was was receiving data. (Network Error: %s) Try connecting again.
|
||||
|
||||
## @name NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS
|
||||
12529=An error occurred sending mail: the return mail address was invalid. Please verify that your email address is correct in your Mail preferences and try again.
|
||||
|
||||
## @name NS_ERROR_POP3_PASSWORD_UNDEFINED
|
||||
12530=Error getting mail password.
|
||||
|
||||
## @name NS_ERROR_MIME_MPART_ATTACHMENT_ERROR
|
||||
12531=Attachment error.
|
||||
|
||||
@ -66,7 +66,6 @@ EXPORTS = \
|
||||
nsMsgCompFields.h \
|
||||
nsMsgAttachmentHandler.h \
|
||||
nsMsgPrompts.h \
|
||||
nsMsgTransition.h \
|
||||
nsMsgQuote.h \
|
||||
nsURLFetcher.h \
|
||||
nsMsgSend.h \
|
||||
|
||||
@ -38,7 +38,6 @@ EXPORTS= nsSmtpUrl.h \
|
||||
nsMsgCompFields.h \
|
||||
nsMsgQuote.h \
|
||||
nsURLFetcher.h \
|
||||
nsMsgTransition.h \
|
||||
nsSmtpServer.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -22,11 +22,10 @@
|
||||
#include "msgCore.h"
|
||||
#include "prprf.h" /* should be defined into msgCore.h? */
|
||||
#include "nsMsgHeaderMasks.h"
|
||||
|
||||
#include "nsMsgTransition.h"
|
||||
|
||||
#include "nsIMsgCompFields.h"
|
||||
|
||||
#include "nsMsgZapIt.h"
|
||||
#include "msgcom.h"
|
||||
#include "rosetta_mailnews.h"
|
||||
|
||||
/* Note that all the "Get" methods never return NULL (except in case of serious
|
||||
error, like an illegal parameter); rather, they return "" if things were set
|
||||
|
||||
@ -51,8 +51,14 @@
|
||||
#define SMTP_DELIV_MAIL NS_MSG_GENERATE_SUCCESS(12521)
|
||||
#define SMTP_MESSAGE_SENT_WAITING_MAIL_REPLY NS_MSG_GENERATE_SUCCESS(12522)
|
||||
#define SMTP_PROGRESS_MAILSENT NS_MSG_GENERATE_SUCCESS(12523)
|
||||
#define SMTP_SERVER_ERROR NS_MSG_GENERATE_FAILURE(12524)
|
||||
#define NS_ERROR_SMTP_SERVER_ERROR NS_MSG_GENERATE_FAILURE(12524)
|
||||
#define NS_MSG_UNABLE_TO_SEND_LATER NS_MSG_GENERATE_FAILURE(12525)
|
||||
#define NS_ERROR_COMMUNICATIONS_ERROR NS_MSG_GENERATE_FAILURE(12526)
|
||||
#define NS_ERROR_BUT_DONT_SHOW_ALERT NS_MSG_GENERATE_FAILURE(12527)
|
||||
#define NS_ERROR_TCP_READ_ERROR NS_MSG_GENERATE_FAILURE(12528)
|
||||
#define NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS NS_MSG_GENERATE_FAILURE(12529)
|
||||
#define NS_ERROR_POP3_PASSWORD_UNDEFINED NS_MSG_GENERATE_FAILURE(12530)
|
||||
#define NS_ERROR_MIME_MPART_ATTACHMENT_ERROR NS_MSG_GENERATE_FAILURE(12531)
|
||||
|
||||
NS_BEGIN_EXTERN_C
|
||||
|
||||
|
||||
@ -44,10 +44,8 @@
|
||||
#include "nsIMsgCopyServiceListener.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsMsgCopy.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgPrompts.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLLinkElement.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
@ -1335,14 +1333,12 @@ PRUint32 i;
|
||||
// we will have memory problems and we should just return
|
||||
// with an error.
|
||||
if (multipartCount != mMultipartRelatedAttachmentCount) {
|
||||
//return MK_MIME_MPART_ATTACHMENT_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
|
||||
}
|
||||
|
||||
rv = mEditor->GetEmbeddedObjects(&aNodeList);
|
||||
if ((NS_FAILED(rv) || (!aNodeList))) {
|
||||
//return MK_MIME_MPART_ATTACHMENT_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
|
||||
}
|
||||
|
||||
nsMsgAttachmentData attachment;
|
||||
@ -1368,15 +1364,13 @@ PRUint32 i;
|
||||
nsISupports *isupp = aNodeList->ElementAt(locCount);
|
||||
|
||||
if (!isupp) {
|
||||
//return MK_MIME_MPART_ATTACHMENT_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
|
||||
}
|
||||
|
||||
node = do_QueryInterface(isupp);
|
||||
NS_IF_RELEASE(isupp); // make sure we cleanup
|
||||
if (!node) {
|
||||
//return MK_MIME_MPART_ATTACHMENT_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
|
||||
}
|
||||
|
||||
// Now, we know the types of objects this node can be, so we will do
|
||||
@ -1478,8 +1472,7 @@ PRUint32 i;
|
||||
else
|
||||
{
|
||||
// If we get here, we got something we didn't expect!
|
||||
//return MK_MIME_MPART_ATTACHMENT_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
@ -2622,10 +2615,14 @@ nsMsgComposeAndSend::Fail(nsresult failure_code, const PRUnichar * error_msg)
|
||||
{
|
||||
if (NS_FAILED(failure_code))
|
||||
{
|
||||
if (!error_msg)
|
||||
nsMsgDisplayMessageByID(failure_code);
|
||||
else
|
||||
nsMsgDisplayMessageByString(error_msg);
|
||||
// in certain cases, we've already shown the alert
|
||||
// and we don't need to show another alert here.
|
||||
if (failure_code != NS_ERROR_BUT_DONT_SHOW_ALERT) {
|
||||
if (!error_msg)
|
||||
nsMsgDisplayMessageByID(failure_code);
|
||||
else
|
||||
nsMsgDisplayMessageByString(error_msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_attachments_done_callback)
|
||||
@ -3390,7 +3387,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
|
||||
}
|
||||
|
||||
//
|
||||
// First, we we need to put a Berkely "From - " delimiter at the head of
|
||||
// First, we we need to put a Berkeley "From - " delimiter at the head of
|
||||
// the file for parsing...
|
||||
//
|
||||
turi = GetFolderURIFromUserPrefs(mode, mUserIdentity);
|
||||
|
||||
@ -124,7 +124,6 @@
|
||||
#include "rosetta_mailnews.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsMsgMessageFlags.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsIMsgSend.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsMsgAttachmentHandler.h"
|
||||
|
||||
@ -28,8 +28,6 @@
|
||||
#include "nsFileStream.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
|
||||
#include "nsMsgTransition.h"
|
||||
|
||||
// defined in msgCompGlue.cpp
|
||||
static char *mime_mailto_stream_read_buffer = 0;
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "msgCore.h"
|
||||
#include "prprf.h" /* should be defined into msgCore.h? */
|
||||
#include "intl_csi.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsMsgZapIt.h"
|
||||
#include "nsMsgSend.h"
|
||||
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//
|
||||
// The goal is to get this file to ZERO and then all old world stuff will
|
||||
// be gone...we're getting much closer :-)
|
||||
//
|
||||
|
||||
#ifndef _nsMsgTransition_h_
|
||||
#define _nsMsgTransition_h_
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
#include "rosetta_mailnews.h"
|
||||
#include "msgcom.h"
|
||||
#include "nsMsgZapIt.h"
|
||||
|
||||
// These are transitional defines that will go away when we
|
||||
// define new NS_... error codes...nsSmptProtocol.cpp is the last
|
||||
// holdout.
|
||||
//
|
||||
#define MK_SMTP_SERVER_ERROR -234
|
||||
#define MK_TCP_READ_ERROR -252
|
||||
#define MK_COULD_NOT_LOGIN_TO_SMTP_SERVER -229
|
||||
#define MK_COULD_NOT_GET_USERS_MAIL_ADDRESS -235
|
||||
#define MK_OUT_OF_MEMORY -207
|
||||
#define MK_POP3_PASSWORD_UNDEFINED -313
|
||||
#define MK_ERROR_SENDING_FROM_COMMAND -230
|
||||
#define MK_ERROR_SENDING_RCPT_COMMAND -231
|
||||
#define MK_ERROR_SENDING_DATA_COMMAND -232
|
||||
#define MK_ERROR_SENDING_MESSAGE -233
|
||||
#define MK_MIME_NO_RECIPIENTS -267
|
||||
#define MK_MIME_MPART_ATTACHMENT_ERROR -268
|
||||
|
||||
#endif /* _nsMsgTransition_h_ */
|
||||
@ -16,7 +16,6 @@
|
||||
* Reserved.
|
||||
*/
|
||||
#include "msgCore.h"
|
||||
#include "nsMsgTransition.h" // need this to get MK_ defines...
|
||||
#include "nsSmtpProtocol.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIStreamListener.h"
|
||||
@ -27,6 +26,10 @@
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsINetSupportDialogService.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTextFormater.h"
|
||||
|
||||
#include "prtime.h"
|
||||
#include "prlog.h"
|
||||
@ -34,7 +37,12 @@
|
||||
#include "prprf.h"
|
||||
#include "nsEscape.h"
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#include <stdarg.h>
|
||||
#endif /* !XP_UNIX */
|
||||
|
||||
static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -63,19 +71,44 @@ const char *XP_AppCodeName = "Mozilla";
|
||||
#endif
|
||||
#define NET_IS_SPACE(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isspace(x))
|
||||
|
||||
/*
|
||||
* This function takes an error code and associated error data
|
||||
* and creates a string containing a textual description of
|
||||
* what the error is and why it happened.
|
||||
*
|
||||
* The returned string is allocated and thus should be freed
|
||||
* once it has been used.
|
||||
*
|
||||
* This function is defined in mkmessag.c.
|
||||
*/
|
||||
char * NET_ExplainErrorDetails (int code, ...)
|
||||
/* based on in NET_ExplainErrorDetails in mkmessag.c */
|
||||
nsresult nsExplainErrorDetails(int code, ...)
|
||||
{
|
||||
char * rv = PR_smprintf("%s", "Error descriptions not implemented yet");
|
||||
nsresult rv;
|
||||
va_list args;
|
||||
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kCNetSupportDialogCID, &rv);
|
||||
|
||||
PRUnichar *msg = nsnull;
|
||||
PRUnichar *eMsg = nsnull;
|
||||
|
||||
va_start (args, code);
|
||||
|
||||
switch (code) {
|
||||
case NS_ERROR_SMTP_SERVER_ERROR:
|
||||
case NS_ERROR_TCP_READ_ERROR:
|
||||
case NS_ERROR_SENDING_FROM_COMMAND:
|
||||
case NS_ERROR_SENDING_RCPT_COMMAND:
|
||||
case NS_ERROR_SENDING_DATA_COMMAND:
|
||||
case NS_ERROR_SENDING_MESSAGE:
|
||||
eMsg = ComposeGetStringByID(code);
|
||||
msg = nsTextFormater::vsmprintf(eMsg, args);
|
||||
nsCRT::free(eMsg);
|
||||
break;
|
||||
default:
|
||||
eMsg = ComposeGetStringByID(NS_ERROR_COMMUNICATIONS_ERROR);
|
||||
msg = nsTextFormater::smprintf(eMsg, code);
|
||||
nsCRT::free(eMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
rv = dialog->Alert(msg);
|
||||
nsTextFormater::smprintf_free(msg);
|
||||
}
|
||||
|
||||
va_end (args);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -225,7 +258,9 @@ void nsSmtpProtocol::Initialize(nsIURI * aURL)
|
||||
m_flags = 0;
|
||||
m_port = SMTP_PORT;
|
||||
|
||||
if (aURL)
|
||||
m_urlErrorState = NS_ERROR_FAILURE;
|
||||
|
||||
if (aURL)
|
||||
m_runningURL = do_QueryInterface(aURL);
|
||||
|
||||
// extract out message feedback if there is any.
|
||||
@ -380,21 +415,23 @@ PRInt32 nsSmtpProtocol::SmtpResponse(nsIInputStream * inputStream, PRUint32 leng
|
||||
m_nextState = SMTP_ERROR_DONE;
|
||||
ClearFlag(SMTP_PAUSE_FOR_READ);
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_SMTP_SERVER_ERROR, (const char*)m_responseText));
|
||||
status = MK_SMTP_SERVER_ERROR;
|
||||
return(MK_SMTP_SERVER_ERROR);
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_SMTP_SERVER_ERROR, (const char*)m_responseText);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
return(NS_ERROR_SMTP_SERVER_ERROR);
|
||||
}
|
||||
|
||||
/* if TCP error of if there is not a full line yet return
|
||||
*/
|
||||
if(status < 0)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_TCP_READ_ERROR, PR_GetOSError()));
|
||||
/* return TCP error
|
||||
*/
|
||||
return MK_TCP_READ_ERROR;
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_TCP_READ_ERROR, PR_GetOSError());
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
/* return TCP error */
|
||||
return(NS_ERROR_TCP_READ_ERROR);
|
||||
}
|
||||
else if(!line)
|
||||
{
|
||||
@ -438,9 +475,8 @@ PRInt32 nsSmtpProtocol::LoginResponse(nsIInputStream * inputStream, PRUint32 len
|
||||
|
||||
if(m_responseCode != 220)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_COULD_NOT_LOGIN_TO_SMTP_SERVER));
|
||||
return(MK_COULD_NOT_LOGIN_TO_SMTP_SERVER);
|
||||
m_urlErrorState = NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER;
|
||||
return(NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER);
|
||||
}
|
||||
|
||||
buffer += GetUserDomainName();
|
||||
@ -464,9 +500,8 @@ PRInt32 nsSmtpProtocol::ExtensionLoginResponse(nsIInputStream * inputStream, PRU
|
||||
|
||||
if(m_responseCode != 220)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_COULD_NOT_LOGIN_TO_SMTP_SERVER));
|
||||
return(MK_COULD_NOT_LOGIN_TO_SMTP_SERVER);
|
||||
m_urlErrorState = NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER;
|
||||
return(NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER);
|
||||
}
|
||||
|
||||
buffer += GetUserDomainName();
|
||||
@ -498,9 +533,8 @@ PRInt32 nsSmtpProtocol::SendHeloResponse(nsIInputStream * inputStream, PRUint32
|
||||
|
||||
if(!userAddress)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS));
|
||||
return(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS);
|
||||
m_urlErrorState = NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS;
|
||||
return(NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS);
|
||||
}
|
||||
|
||||
if(m_verifyAddress)
|
||||
@ -696,7 +730,7 @@ PRInt32 nsSmtpProtocol::AuthLoginResponse(nsIInputStream * stream, PRUint32 leng
|
||||
* they want auth login we're just going to return an error
|
||||
* and not let the msg be sent to the server
|
||||
*/
|
||||
status = MK_POP3_PASSWORD_UNDEFINED;
|
||||
status = NS_ERROR_POP3_PASSWORD_UNDEFINED;
|
||||
}
|
||||
PR_FREEIF(net_smtp_name);
|
||||
PR_FREEIF(tmp_name);
|
||||
@ -720,7 +754,7 @@ PRInt32 nsSmtpProtocol::AuthLoginUsername()
|
||||
if (!net_smtp_name || !*net_smtp_name)
|
||||
{
|
||||
PR_FREEIF(net_smtp_name);
|
||||
return (MK_POP3_USERNAME_UNDEFINED);
|
||||
return (NS_POP3_USERNAME_UNDEFINED);
|
||||
}
|
||||
|
||||
if (m_authMethod == 1)
|
||||
@ -739,7 +773,7 @@ PRInt32 nsSmtpProtocol::AuthLoginUsername()
|
||||
if (!net_smtp_password)
|
||||
net_smtp_password = net_smtp_prompt_for_password(cur_entry);
|
||||
if (!net_smtp_password)
|
||||
return MK_POP3_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_POP3_PASSWORD_UNDEFINED;
|
||||
}
|
||||
|
||||
nsCRT::memset(plain_string, 0, 512);
|
||||
@ -757,7 +791,7 @@ PRInt32 nsSmtpProtocol::AuthLoginUsername()
|
||||
else if (m_authMethod == SMTP_AUTH_PLAIN)
|
||||
PR_snprintf(buffer, sizeof(buffer), "AUTH PLAIN %.256s" CRLF, base64Str);
|
||||
else
|
||||
return (MK_COMMUNICATIONS_ERROR);
|
||||
return (NS_ERROR_COMMUNICATIONS_ERROR);
|
||||
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
|
||||
status = SendData(url, buffer);
|
||||
@ -795,7 +829,7 @@ PRInt32 nsSmtpProtocol::AuthLoginPassword()
|
||||
PR_FREEIF(net_smtp_password);
|
||||
net_smtp_password = net_smtp_prompt_for_password(cur_entry);
|
||||
if (!net_smtp_password)
|
||||
return MK_POP3_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_POP3_PASSWORD_UNDEFINED;
|
||||
}
|
||||
|
||||
PR_ASSERT(net_smtp_password);
|
||||
@ -830,9 +864,9 @@ PRInt32 nsSmtpProtocol::SendVerifyResponse()
|
||||
char buffer[512];
|
||||
|
||||
if(m_responseCode == 250 || m_responseCode == 251)
|
||||
return(MK_USER_VERIFIED_BY_SMTP);
|
||||
return(NS_USER_VERIFIED_BY_SMTP);
|
||||
else
|
||||
return(MK_USER_NOT_VERIFIED_BY_SMTP);
|
||||
return(NS_USER_NOT_VERIFIED_BY_SMTP);
|
||||
#else
|
||||
PR_ASSERT(0);
|
||||
return(-1);
|
||||
@ -846,9 +880,11 @@ PRInt32 nsSmtpProtocol::SendMailResponse()
|
||||
|
||||
if(m_responseCode != 250)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_ERROR_SENDING_FROM_COMMAND, (const char*)m_responseText));
|
||||
return(MK_ERROR_SENDING_FROM_COMMAND);
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_SENDING_FROM_COMMAND, (const char*)m_responseText);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
return(NS_ERROR_SENDING_FROM_COMMAND);
|
||||
}
|
||||
|
||||
/* Send the RCPT TO: command */
|
||||
@ -873,8 +909,8 @@ PRInt32 nsSmtpProtocol::SendMailResponse()
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MK_OUT_OF_MEMORY;
|
||||
return (status);
|
||||
m_urlErrorState = NS_ERROR_OUT_OF_MEMORY;
|
||||
return (NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -905,9 +941,11 @@ PRInt32 nsSmtpProtocol::SendRecipientResponse()
|
||||
|
||||
if(m_responseCode != 250 && m_responseCode != 251)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_ERROR_SENDING_RCPT_COMMAND, (const char*)m_responseText));
|
||||
return(MK_ERROR_SENDING_RCPT_COMMAND);
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_SENDING_RCPT_COMMAND, (const char*)m_responseText);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
return(NS_ERROR_SENDING_RCPT_COMMAND);
|
||||
}
|
||||
|
||||
if(m_addressesLeft > 0)
|
||||
@ -938,10 +976,11 @@ PRInt32 nsSmtpProtocol::SendDataResponse()
|
||||
|
||||
if(m_responseCode != 354)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_ERROR_SENDING_DATA_COMMAND,
|
||||
(const char*)m_responseText));
|
||||
return(MK_ERROR_SENDING_DATA_COMMAND);
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_SENDING_DATA_COMMAND, (const char*)m_responseText);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
return(NS_ERROR_SENDING_DATA_COMMAND);
|
||||
}
|
||||
#ifdef UNREADY_CODE
|
||||
#ifdef XP_UNIX
|
||||
@ -958,8 +997,8 @@ PRInt32 nsSmtpProtocol::SendDataResponse()
|
||||
s = (real_name ? MSG_MakeFullAddress (NULL, real_name) : 0);
|
||||
if (real_name && !s)
|
||||
{
|
||||
CE_URL_S->error_msg = NET_ExplainErrorDetails(MK_COULD_NOT_GET_UID);
|
||||
return(MK_COULD_NOT_GET_UID);
|
||||
m_urlErrorState = NS_ERROR_COULD_NOT_GET_UID;
|
||||
return(NS_ERROR_COULD_NOT_GET_UID);
|
||||
}
|
||||
if(real_name)
|
||||
{
|
||||
@ -968,8 +1007,8 @@ PRInt32 nsSmtpProtocol::SendDataResponse()
|
||||
NET_SACat(command, buffer);
|
||||
if(!command)
|
||||
{
|
||||
CE_URL_S->error_msg = NET_ExplainErrorDetails(MK_OUT_OF_MEMORY);
|
||||
return(MK_OUT_OF_MEMORY);
|
||||
m_urlErrorState = NS_ERROR_OUT_OF_MEMORY;
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
status = (int) NET_BlockingWrite(CE_SOCK, command, PL_strlen(command));
|
||||
@ -1186,9 +1225,11 @@ PRInt32 nsSmtpProtocol::SendMessageResponse()
|
||||
|
||||
if(m_responseCode != 250)
|
||||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(MK_ERROR_SENDING_MESSAGE, (const char*)m_responseText));
|
||||
return(MK_ERROR_SENDING_MESSAGE);
|
||||
nsresult rv = nsExplainErrorDetails(NS_ERROR_SENDING_MESSAGE, (const char*)m_responseText);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
|
||||
|
||||
m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
|
||||
return(NS_ERROR_SENDING_MESSAGE);
|
||||
}
|
||||
|
||||
UpdateStatus(SMTP_PROGRESS_MAILSENT);
|
||||
@ -1280,10 +1321,9 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer )
|
||||
{
|
||||
m_nextState = SMTP_ERROR_DONE;
|
||||
ClearFlag(SMTP_PAUSE_FOR_READ);
|
||||
status = MK_MIME_NO_RECIPIENTS;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
|
||||
url->SetErrorMessage(NET_ExplainErrorDetails(status));
|
||||
return status;
|
||||
status = NS_MSG_NO_RECIPIENTS;
|
||||
m_urlErrorState = NS_MSG_NO_RECIPIENTS;
|
||||
return(status);
|
||||
}
|
||||
|
||||
m_addressCopy = addrs2;
|
||||
@ -1423,7 +1463,8 @@ nsresult nsSmtpProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inp
|
||||
case SMTP_ERROR_DONE:
|
||||
{
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(m_runningURL);
|
||||
mailNewsUrl->SetUrlState(PR_FALSE, NS_ERROR_FAILURE);
|
||||
// propagate the right error code
|
||||
mailNewsUrl->SetUrlState(PR_FALSE, m_urlErrorState);
|
||||
m_nextState = SMTP_FREE;
|
||||
}
|
||||
m_nextState = SMTP_FREE;
|
||||
@ -1495,10 +1536,10 @@ NET_SendMessageUnattended(MWContext* context, char* to, char* subject,
|
||||
|
||||
urlstring = PR_smprintf("mailto:%s", convto ? convto : to);
|
||||
|
||||
if (!urlstring) return MK_OUT_OF_MEMORY;
|
||||
if (!urlstring) return NS_ERROR_OUT_OF_MEMORY;
|
||||
url = NET_CreateURLStruct(urlstring, NET_DONT_RELOAD);
|
||||
PR_FREEIF(urlstring);
|
||||
if (!url) return MK_OUT_OF_MEMORY;
|
||||
if (!url) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
|
||||
@ -1510,9 +1551,9 @@ Subject: %s\n\
|
||||
otherheaders);
|
||||
if (convto) PR_FREEIF(convto);
|
||||
if (convsub) PR_FREEIF(convsub);
|
||||
if (!url->post_headers) return MK_OUT_OF_MEMORY;
|
||||
if (!url->post_headers) return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->post_data = PL_strdup(body);
|
||||
if (!url->post_data) return MK_OUT_OF_MEMORY;
|
||||
if (!url->post_data) return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->post_data_size = PL_strlen(url->post_data);
|
||||
url->post_data_is_file = PR_FALSE;
|
||||
url->method = URL_POST_METHOD;
|
||||
|
||||
@ -85,6 +85,8 @@ public:
|
||||
private:
|
||||
// the nsISmtpURL that is currently running
|
||||
nsCOMPtr<nsISmtpUrl> m_runningURL;
|
||||
// the error state we want to set on the url
|
||||
nsresult m_urlErrorState;
|
||||
PRUint32 m_LastTime;
|
||||
nsCOMPtr<nsIMsgStatusFeedback> m_statusFeedback;
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIFileLocator.h"
|
||||
#include "xp.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIFileLocator.h"
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIMimeURLUtils.h"
|
||||
|
||||
@ -48,7 +48,6 @@
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIFileLocator.h"
|
||||
|
||||
#include "nsMsgTransition.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prmem.h"
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
12510=No sender was specified. Please fill in your email address in the Mail and Newsgroup preferences.
|
||||
|
||||
## @name NS_MSG_NO_RECIPIENTS
|
||||
12511=No recipients were specified. Please enter a recipient in a To: line, or a newsgroup in a Group: line..
|
||||
12511=No recipients were specified. Please enter a recipient in a To: line, or a newsgroup in a Newsgroup: line..
|
||||
|
||||
## @name NS_MSG_ERROR_WRITING_FILE
|
||||
12512=Error writing temporary file.
|
||||
@ -60,7 +60,7 @@
|
||||
12513=An error occurred sending mail: Unable to connect to the SMTP server. The server may be down or may be incorrectly configured. Please verify that your Mail preferences are correct and try again.
|
||||
|
||||
## @name NS_ERROR_SENDING_FROM_COMMAND
|
||||
12514=An error occurred while sending mail. The mail server responded: %s Please verify that your email address is correct in your Mail preferences and try again.
|
||||
12514=An error occurred while sending mail. The mail server responded: %s. Please verify that your email address is correct in your Mail preferences and try again.
|
||||
|
||||
## @name NS_ERROR_SENDING_RCPT_COMMAND
|
||||
12515=An error occurred while sending mail. The mail server responded: %s. Please check the message recipients and try again.
|
||||
@ -89,8 +89,26 @@
|
||||
## @name SMTP_PROGRESS_MAILSENT
|
||||
12523=Mail sent successfully
|
||||
|
||||
## @name SMTP_SERVER_ERROR
|
||||
## @name NS_ERROR_SMTP_SERVER_ERROR
|
||||
12524=An error occurred sending mail: SMTP server error. The server responded: %s Contact your mail administrator for assistance.
|
||||
|
||||
## @name NS_MSG_UNABLE_TO_SEND_LATER
|
||||
12525=Unable to save your message in order to send it later. Please verify that your Mail preferences are correct and try again.
|
||||
|
||||
## @name NS_ERROR_COMMUNICATIONS_ERROR
|
||||
12526=A communications error occurred: %d. Please try again.
|
||||
|
||||
## @name NS_ERROR_BUT_DONT_SHOW_ALERT
|
||||
12527=THIS IS JUST A PLACEHOLDER. YOU SHOULD NEVER SEE THIS STRING.
|
||||
|
||||
## @name NS_ERROR_TCP_READ_ERROR
|
||||
12528=A network error occurred while Mozilla was was receiving data. (Network Error: %s) Try connecting again.
|
||||
|
||||
## @name NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS
|
||||
12529=An error occurred sending mail: the return mail address was invalid. Please verify that your email address is correct in your Mail preferences and try again.
|
||||
|
||||
## @name NS_ERROR_POP3_PASSWORD_UNDEFINED
|
||||
12530=Error getting mail password.
|
||||
|
||||
## @name NS_ERROR_MIME_MPART_ATTACHMENT_ERROR
|
||||
12531=Attachment error.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user