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
Родитель c0200de043
Коммит f4531df236
2 изменённых файлов: 52 добавлений и 9 удалений

Просмотреть файл

@ -1601,13 +1601,13 @@ function GenericSendMessage( msgType )
{
var result = {value:sComposeMsgsBundle.getString("defaultSubject")};
if (gPromptService.prompt(
window,
sComposeMsgsBundle.getString("subjectDlogTitle"),
sComposeMsgsBundle.getString("subjectDlogMessage"),
result,
null,
{value:0}
))
window,
sComposeMsgsBundle.getString("subjectDlogTitle"),
sComposeMsgsBundle.getString("subjectDlogMessage"),
result,
null,
{value:0}
))
{
msgCompFields.subject = result.value;
var subjectInputElem = document.getElementById("msgSubject");
@ -1615,8 +1615,48 @@ function GenericSendMessage( msgType )
}
else
return;
}
}
}
// 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.
var convert = DetermineConvertibility();
@ -1692,7 +1732,7 @@ function GenericSendMessage( msgType )
}
msgWindow.SetDOMWindow(window);
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), getCurrentAccountKey(), msgWindow, progress);
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), currentAccountKey, msgWindow, progress);
}
catch (ex) {
dump("failed to SendMsg: " + ex + "\n");

Просмотреть файл

@ -259,6 +259,9 @@ windowTitlePrefix=Compose:
subjectDlogTitle=Send Message
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
attachPageDlogTitle=Please specify a location to attach
attachPageDlogMessage=Web Page (URL):