Fix for bug 83549. Add a new send mode in order to be able to display correct message when an error occurs while sending unsent messages. R=varada, SR=mscott

This commit is contained in:
ducarroz%netscape.com 2001-10-30 22:36:57 +00:00
parent 603cecab7c
commit 6d724c99a2
8 changed files with 13 additions and 13 deletions

View File

@ -71,6 +71,7 @@ interface nsIMsgCompDeliverMode {
const long SaveAs = 3;
const long SaveAsDraft = 4;
const long SaveAsTemplate = 5;
const long SendUnsent = 6;
};
[scriptable, uuid(f38ea280-e090-11d3-a449-e3153319347c)]

View File

@ -176,12 +176,12 @@ interface nsIMsgSend : nsISupports
//
const nsMsgDeliverMode nsMsgDeliverNow = 0;
const nsMsgDeliverMode nsMsgQueueForLater = 1;
const nsMsgDeliverMode nsMsgSave = 2;
const nsMsgDeliverMode nsMsgSaveAs = 3;
const nsMsgDeliverMode nsMsgSaveAsDraft = 4;
const nsMsgDeliverMode nsMsgSaveAsTemplate = 5;
const nsMsgDeliverMode nsMsgSendUnsent = 6;
[noscript]
void createAndSendMessage(in nsIEditorShell aEditor,

View File

@ -580,7 +580,7 @@ mime_generate_headers (nsMsgCompFields *fields,
// Send Later file, etc...). Because of that, we need to store what the user
// typed in on the original composition window for use later when rebuilding
// the headers
if (deliver_mode != nsIMsgSend::nsMsgDeliverNow)
if (deliver_mode != nsIMsgSend::nsMsgDeliverNow && deliver_mode != nsIMsgSend::nsMsgSendUnsent)
{
// This is going to be saved for later, that means we should just store
// what the user typed into the "Newsgroup" line in the HEADER_X_MOZILLA_NEWSHOST

View File

@ -236,7 +236,7 @@ nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
return NS_MSG_UNABLE_TO_SAVE_TEMPLATE;
}
}
else // SaveInSentFolder (Sent) - nsMsgDeliverNow
else // SaveInSentFolder (Sent) - nsMsgDeliverNow or nsMsgSendUnsent
{
rv = GetSentFolder(aUserIdentity, getter_AddRefs(dstFolder), &waitForUrl);
isDraft = PR_FALSE;
@ -531,7 +531,7 @@ LocateMessageFolder(nsIMsgIdentity *userIdentity,
{
rv = rootFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_TEMPLATES, 1, &numFolders, msgFolder);
}
else // SaveInSentFolder (Sent) - nsMsgDeliverNow
else // SaveInSentFolder (Sent) - nsMsgDeliverNow or nsMsgSendUnsent
{
rv = rootFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_SENTMAIL, 1, &numFolders, msgFolder);
}

View File

@ -3915,7 +3915,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
// First, we we need to put a Berkeley "From - " delimiter at the head of
// the file for parsing...
//
if (mode == nsMsgDeliverNow && fcc_header)
if ((mode == nsMsgDeliverNow || mode == nsMsgSendUnsent) && fcc_header)
turi = PL_strdup(fcc_header);
else
turi = GetFolderURIFromUserPrefs(mode, mUserIdentity);
@ -3966,9 +3966,8 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
// Need to add these lines for POP3 ONLY! IMAP servers will handle
// this status information for summary file regeneration for us.
if ( (mode == nsMsgQueueForLater || mode == nsMsgSaveAsDraft ||
mode == nsMsgSaveAsTemplate || mode == nsMsgDeliverNow) &&
folderIsLocal
)
mode == nsMsgSaveAsTemplate || mode == nsMsgDeliverNow ||
mode == nsMsgSendUnsent) && folderIsLocal)
{
char *buf = 0;
PRUint16 flags = 0;

View File

@ -298,7 +298,7 @@ public:
PRBool m_dont_deliver_p; // If set, we just return the nsFileSpec of the file
// created, instead of actually delivering message.
nsMsgDeliverMode m_deliver_mode; // nsMsgDeliverNow, nsMsgQueueForLater, nsMsgSaveAsDraft,
// nsMsgSaveAsTemplate
// nsMsgSaveAsTemplate and nsMsgSendUnsent
nsCOMPtr<nsIMsgDBHdr> mMsgToReplace; // If the mode is nsMsgSaveAsDraft, this is the message it will
// replace

View File

@ -541,7 +541,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
mTempIFileSpec, // nsIFileSpec *sendFileSpec,
PR_TRUE, // PRBool deleteSendFileOnCompletion,
PR_FALSE, // PRBool digest_p,
nsIMsgSend::nsMsgDeliverNow, // nsMsgDeliverMode mode,
nsIMsgSend::nsMsgSendUnsent, // nsMsgDeliverMode mode,
nsnull, // nsIMsgDBHdr *msgToReplace,
sendListener,
nsnull);

View File

@ -304,7 +304,7 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
}
}
if (mDeliveryMode == nsIMsgCompDeliverMode::Now)
if (mDeliveryMode == nsIMsgCompDeliverMode::Now || mDeliveryMode == nsIMsgCompDeliverMode::SendUnsent)
{
// SMTP is taking care of it's own error message and will return NS_ERROR_BUT_DONT_SHOW_ALERT as error code.
// In that case, we must not show an alert ourself.
@ -339,11 +339,11 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
break;
case process_Copy:
preStrId = NS_MSG_FAILED_COPY_OPERATION;
askToGoBackToCompose = PR_TRUE;
askToGoBackToCompose = (mDeliveryMode == nsIMsgCompDeliverMode::Now);
break;
case process_FCC:
preStrId = NS_MSG_FAILED_COPY_OPERATION;
askToGoBackToCompose = PR_TRUE;
askToGoBackToCompose = (mDeliveryMode == nsIMsgCompDeliverMode::Now);
break;
}
composebundle->GetStringByID(preStrId, getter_Copies(dialogMessage));