Bug 234186 Don't allow mail identites to post to newsgroups p=ch.ey@gmx.net r=me sr=mscott

This commit is contained in:
neil%parkwaycc.co.uk 2004-04-19 17:07:07 +00:00
parent 255bacc1d4
commit f0a4f9efc5
2 changed files with 52 additions and 9 deletions

View File

@ -1618,6 +1618,46 @@ 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 != "")
{
const kDontAskAgainPref = "mail.compose.dontWarnMail2Newsgroup";
// default to ask user if the pref is not set
var dontAskAgain = false;
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
dontAskAgain = pref.getBoolPref(kDontAskAgainPref);
} catch (ex) {}
if (!dontAskAgain)
{
var checkbox = {value:false};
var okToProceed = gPromptService.confirmCheck(
window,
sComposeMsgsBundle.getString("subjectDlogTitle"),
sComposeMsgsBundle.getString("recipientDlogMessage"),
sComposeMsgsBundle.getString("CheckMsg"),
checkbox);
if (!okToProceed)
return;
try {
if (checkbox.value)
pref.setBoolPref(kDontAskAgainPref, true);
} catch (ex) {}
}
// 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);
@ -1692,7 +1732,7 @@ function GenericSendMessage( msgType )
} }
msgWindow.SetDOMWindow(window); msgWindow.SetDOMWindow(window);
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), getCurrentAccountKey(), msgWindow, progress); gMsgCompose.SendMsg(msgType, getCurrentIdentity(), currentAccountKey, msgWindow, progress);
} }
catch (ex) { catch (ex) {
dump("failed to SendMsg: " + ex + "\n"); dump("failed to SendMsg: " + ex + "\n");

View File

@ -259,6 +259,9 @@ windowTitlePrefix=Compose:
subjectDlogTitle=Send Message subjectDlogTitle=Send Message
subjectDlogMessage=You did not specify a subject for this message. If you would like to provide one, please type it now. subjectDlogMessage=You did not specify a subject for this message. If you would like to provide one, please type it now.
## String used by the dialog that informs the user about the newsgroup recipient
recipientDlogMessage=This account only supports email recipients. Continuing will ignore newsgroups.
## String used by the dialog that ask the user to attach a web page ## String used by the dialog that ask the user to attach a web page
attachPageDlogTitle=Please specify a location to attach attachPageDlogTitle=Please specify a location to attach
attachPageDlogMessage=Web Page (URL): attachPageDlogMessage=Web Page (URL):