changes so that the alert for cross posting to multiple news server shows up.

(instead of a silent failure.)  note, we are still being too over-zealous when
deciding if you are cross posting to multiple servers.  see bug #35338


git-svn-id: svn://10.0.0.236/trunk@65689 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sspitzer%netscape.com 2000-04-12 09:48:25 +00:00
parent 8c7494bc47
commit d3e6a61e1b
7 changed files with 31 additions and 10 deletions

View File

@ -126,6 +126,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
conflict, I reserve values between 12500 and 12999 for it.
*/
#define NS_MSGCOMP_ERROR_BEGIN 12500
/* NS_ERROR_NNTP_NO_CROSS_POSTING lives here, and not in nsMsgComposeStringBundle.h, because it is used in news and compose. */
#define NS_ERROR_NNTP_NO_CROSS_POSTING NS_MSG_GENERATE_FAILURE(12554)
#define NS_MSGCOMP_ERROR_END 12999
#define MSG_LINEBREAK NS_LINEBREAK

View File

@ -173,6 +173,9 @@ noIdentities=You don't have any email identities yet. Create one with the Accou
## @name NS_MSG_MULTILINGUAL_SEND
12553=Message may not be sent correctly because it contains character(s) out of charset range. Send anyway or cancel to back to compose?
## @name NS_ERROR_NNTP_NO_CROSS_POSTING
12554=You can only send a message to one news server at a time.
## Strings use for the save message dialog shown when the user close a message compose window
saveDlogTitle=Save Message
saveDlogMessage=Message has not been Sent. Do you want to save the message in the Drafts Folder?

View File

@ -206,10 +206,16 @@ nsMsgStripLine (char * string)
char *
mime_generate_headers (nsMsgCompFields *fields,
const char *charset,
nsMsgDeliverMode deliver_mode)
nsMsgDeliverMode deliver_mode, PRInt32 *status)
{
nsresult rv;
*status = 0;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) {
*status = rv;
return nsnull;
}
int size = 0;
char *buffer = 0, *buffer_tail = 0;
@ -232,7 +238,7 @@ mime_generate_headers (nsMsgCompFields *fields,
NS_ASSERTION (fields, "null fields");
if (!fields)
return NULL;
return nsnull;
/* Multiply by 3 here to make enough room for MimePartII conversion */
pFrom = fields->GetFrom(); if (pFrom) size += 3 * PL_strlen (pFrom);
@ -254,7 +260,7 @@ mime_generate_headers (nsMsgCompFields *fields,
buffer = (char *) PR_Malloc (size);
if (!buffer)
return 0; /* NS_ERROR_OUT_OF_MEMORY */
return nsnull; /* NS_ERROR_OUT_OF_MEMORY */
buffer_tail = buffer;
@ -468,7 +474,7 @@ mime_generate_headers (nsMsgCompFields *fields,
ptr = PL_strdup(pNewsGrp);
if (!ptr) {
PR_FREEIF(buffer);
return 0; /* NS_ERROR_OUT_OF_MEMORY */
return nsnull; /* NS_ERROR_OUT_OF_MEMORY */
}
n2 = nsMsgStripLine(ptr);
NS_ASSERTION(n2 == ptr, "n2 != ptr"); /* Otherwise, the PR_Free below is
@ -513,8 +519,10 @@ mime_generate_headers (nsMsgCompFields *fields,
// ConvertNewsgroupsString takes "news://news.mozilla.org./netscape.test,news://news.mozilla.org./netscape.junk"
// and turns it into "netscape.test,netscape.junk"
rv = nntpService->ConvertNewsgroupsString(n2, &newHeader);
if (NS_FAILED(rv))
if (NS_FAILED(rv)) {
*status = rv;
return nsnull;
}
#ifdef NS_DEBUG
else
{
@ -522,8 +530,10 @@ mime_generate_headers (nsMsgCompFields *fields,
}
#endif
}
else
else {
*status = rv;
return nsnull;
}
PUSH_STRING ("Newsgroups: ");
PUSH_STRING (newHeader);
@ -564,7 +574,7 @@ mime_generate_headers (nsMsgCompFields *fields,
ptr = PL_strdup(pFollow);
if (!ptr) {
PR_FREEIF(buffer);
return 0; /* NS_ERROR_OUT_OF_MEMORY */
return nsnull; /* NS_ERROR_OUT_OF_MEMORY */
}
n2 = nsMsgStripLine (ptr);
NS_ASSERTION(n2 == ptr, "n2 != ptr"); /* Otherwise, the PR_Free below is

View File

@ -61,7 +61,7 @@ nsresult mime_sanity_check_fields (
char *mime_generate_headers (nsMsgCompFields *fields,
const char *charset,
nsMsgDeliverMode deliver_mode);
nsMsgDeliverMode deliver_mode, PRInt32 *status);
char *mime_make_separator(const char *prefix);
char *mime_gen_content_id(PRUint32 aPartNum, const char *aEmailAddress);

View File

@ -102,4 +102,7 @@ private:
#define NS_MSG_MULTILINGUAL_SEND NS_MSG_GENERATE_SUCCESS(12553)
/* 12554 is taken by NS_ERROR_NNTP_NO_CROSS_POSTING. use 12555 as the next one */
#endif /* _nsMsgComposeStringBundle_H_ */

View File

@ -836,7 +836,10 @@ nsMsgComposeAndSend::GatherMimeAttachments()
/* Write out the message headers.
*/
headers = mime_generate_headers (mCompFields, mCompFields->GetCharacterSet(),
m_deliver_mode);
m_deliver_mode, &status);
if (status < 0)
goto FAIL;
if (!headers)
goto FAILMEM;

View File

@ -714,7 +714,7 @@ nsresult nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, cha
printf("no cross posting to multiple hosts!\n");
#endif
CRTFREEIF(list);
return NS_ERROR_FAILURE;
return NS_ERROR_NNTP_NO_CROSS_POSTING;
}
}