Port Bug #234186 --> Messages with mail server identity should not be sent through newsserver

to thunderbird

Patch by Christian Eyrich
This commit is contained in:
scott%scott-macgregor.org 2004-04-27 07:02:48 +00:00
parent b52c6a4485
commit c17f954b0c
2 changed files with 95 additions and 64 deletions

View File

@ -59,6 +59,8 @@ pref("editor.singleLine.pasteNewlines", 4); // substitute commas for new lines
// to avoid the height of the header area from changing when headers are present / not present // to avoid the height of the header area from changing when headers are present / not present
pref("mailnews.headers.minNumHeaders", 0); // 0 means we ignore this pref pref("mailnews.headers.minNumHeaders", 0); // 0 means we ignore this pref
pref("mail.compose.dontWarnMail2Newsgroup", false);
pref("messenger.throbber.url","chrome://messenger-region/locale/region.properties"); pref("messenger.throbber.url","chrome://messenger-region/locale/region.properties");
pref("mailnews.release_notes.url","chrome://messenger-region/locale/region.properties"); pref("mailnews.release_notes.url","chrome://messenger-region/locale/region.properties");
pref("mailnews.hints_and_tips.url","chrome://messenger-region/locale/region.properties"); pref("mailnews.hints_and_tips.url","chrome://messenger-region/locale/region.properties");

View File

@ -1637,7 +1637,8 @@ function GenericSendMessage( msgType )
if (msgType == nsIMsgCompDeliverMode.Now || msgType == nsIMsgCompDeliverMode.Later) if (msgType == nsIMsgCompDeliverMode.Now || msgType == nsIMsgCompDeliverMode.Later)
{ {
//Do we need to check the spelling? //Do we need to check the spelling?
if (sPrefs.getBoolPref("mail.SpellCheckBeforeSend")){ if (sPrefs.getBoolPref("mail.SpellCheckBeforeSend"))
{
//We disable spellcheck for the following -subject line, attachment pane, identity and addressing widget //We disable spellcheck for the following -subject line, attachment pane, identity and addressing widget
//therefore we need to explicitly focus on the mail body when we have to do a spellcheck. //therefore we need to explicitly focus on the mail body when we have to do a spellcheck.
window.content.focus(); window.content.focus();
@ -1663,8 +1664,7 @@ function GenericSendMessage( msgType )
sComposeMsgsBundle.getString("subjectDlogMessage"), sComposeMsgsBundle.getString("subjectDlogMessage"),
result, result,
null, null,
{value:0} {value:0}))
))
{ {
msgCompFields.subject = result.value; msgCompFields.subject = result.value;
var subjectInputElem = document.getElementById("msgSubject"); var subjectInputElem = document.getElementById("msgSubject");
@ -1675,6 +1675,36 @@ function GenericSendMessage( msgType )
} }
} }
// check if the user tries to send a message to a newsgroup through a mail account
var currentAccountKey = getCurrentAccountKey();
var account = gAccountManager.getAccount(currentAccountKey);
var servertype = account.incomingServer.type;
if (servertype != "nntp" && msgCompFields.newsgroups != "")
{
// default to ask user if the pref is not set
var dontAskAgain = sPrefs.getBoolPref("mail.compose.dontWarnMail2Newsgroup");
if (!dontAskAgain)
{
var checkbox = {value:false};
var okToProceed = gPromptService.confirmCheck(window,
sComposeMsgsBundle.getString("subjectDlogTitle"),
sComposeMsgsBundle.getString("recipientDlogMessage"),
sComposeMsgsBundle.getString("CheckMsg"), checkbox);
if (!okToProceed)
return;
if (checkbox.value)
sPrefs.setBoolPref(kDontAskAgainPref, true);
}
// remove newsgroups to prevent news_p to be set
// in nsMsgComposeAndSend::DeliverMessage()
msgCompFields.newsgroups = "";
}
// Before sending the message, check what to do with HTML message, eventually abort. // Before sending the message, check what to do with HTML message, eventually abort.
var convert = DetermineConvertibility(); var convert = DetermineConvertibility();
var action = DetermineHTMLAction(convert); var action = DetermineHTMLAction(convert);
@ -1755,8 +1785,7 @@ function GenericSendMessage( msgType )
gSendOrSaveOperationInProgress = true; gSendOrSaveOperationInProgress = true;
} }
msgWindow.SetDOMWindow(window); msgWindow.SetDOMWindow(window);
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), currentAccountKey, msgWindow, progress);
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), getCurrentAccountKey(), msgWindow, progress);
} }
catch (ex) { catch (ex) {
dump("failed to SendMsg: " + ex + "\n"); dump("failed to SendMsg: " + ex + "\n");