[Bug 380354] add an option to forward without the .eml extension since

some virus scanner settings make a fuzz about it.
p=rsx11m.pub@gmail.com, r=mnyromyr, sr=bienvenu
This commit is contained in:
mkmelin+mozilla%iki.fi 2007-12-27 17:21:58 +00:00
Родитель 6e64029ee7
Коммит fe60339a0f
4 изменённых файлов: 33 добавлений и 3 удалений

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

@ -51,7 +51,7 @@
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<prefpane id="paneCompose" onpaneload="gComposePane.init();">
<script type="application/x-javascript" src="chrome://messenger/content/preferences/compose.js"/>
@ -62,6 +62,7 @@
<preferences>
<preference id="mail.preferences.compose.selectedTabIndex" name="mail.preferences.compose.selectedTabIndex" type="int"/>
<preference id="mail.forward_message_mode" name="mail.forward_message_mode" type="int"/>
<preference id="mail.forward_add_extension" name="mail.forward_add_extension" type="bool"/>
<preference id="mail.SpellCheckBeforeSend" name="mail.SpellCheckBeforeSend" type="bool"/>
<preference id="mail.spellcheck.inline" name="mail.spellcheck.inline" type="bool"/>
<preference id="mail.strictly_mime" name="mail.strictly_mime" type="bool"/>
@ -99,6 +100,8 @@
<menuitem value="0" label="&asAttachment.label;" accesskey="&asAttachment.accesskey;"/>
</menupopup>
</menulist>
<checkbox id="addExtension" label="&addExtension.label;" preference="mail.forward_add_extension"
accesskey="&addExtension.accesskey;"/>
</hbox>
<hbox align="center" pack="start">

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

@ -5,11 +5,13 @@
<!ENTITY forwardReply.label "Forwarding Messages">
<!ENTITY forwardMsg.label "Forward messages:">
<!ENTITY forwardMsg.accesskey "f">
<!ENTITY forwardMsg.accesskey "w">
<!ENTITY inline.label "Inline">
<!ENTITY inline.accesskey "I">
<!ENTITY asAttachment.label "As Attachment">
<!ENTITY asAttachment.accesskey "A">
<!ENTITY addExtension.label "add extension to file name">
<!ENTITY addExtension.accesskey "f">
<!ENTITY htmlComposeHeader.label "HTML">
<!ENTITY font.label "Font:">

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

@ -2014,7 +2014,31 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
nsCOMPtr<nsIMsgAttachment> attachment = do_CreateInstance(NS_MSGATTACHMENT_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && attachment)
{
attachment->SetName(subject + NS_LITERAL_STRING(".eml"));
PRBool addExtension = PR_TRUE;
nsString sanitizedSubj;
if (prefs)
prefs->GetBoolPref("mail.forward_add_extension", &addExtension);
// copy subject string to sanitizedSubj, use default if empty
if (subject.IsEmpty())
{
nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> composeBundle;
rv = bundleService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties",
getter_AddRefs(composeBundle));
NS_ENSURE_SUCCESS(rv, rv);
composeBundle->GetStringFromName(NS_LITERAL_STRING("messageAttachmentSafeName").get(),
getter_Copies(sanitizedSubj));
}
else
sanitizedSubj.Assign(subject);
// change all '.' to '_' see bug #271211
sanitizedSubj.ReplaceChar('.', '_');
attachment->SetName(addExtension ? sanitizedSubj + NS_LITERAL_STRING(".eml") : sanitizedSubj);
attachment->SetUrl(uri);
m_compFields->AddAttachment(attachment);
}

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

@ -541,6 +541,7 @@ This option is mainly for the UI of html_as.
*/
pref("mail.forward_message_mode", 0); // 0=default as attachment 2=forward as inline with attachments, (obsolete 4.x value)1=forward as quoted (mapped to 2 in mozilla)
pref("mail.forward_add_extension", true); // add .eml extension when forwarding as attachment
pref("mail.startup.enabledMailCheckOnce", false);