fix for 37972 and 37976. Enable address book collection prefs for incoming and outgoing

mail. r=sspitzer.
This commit is contained in:
putterman%netscape.com 2000-06-15 04:57:16 +00:00
parent a1a494ff33
commit 839e0beab3
6 changed files with 36 additions and 7 deletions

View File

@ -12,7 +12,7 @@
<script language="javascript">
<![CDATA[
var _elementIDs = ["emailCollection"];
var _elementIDs = ["emailCollection", "emailCollectionIncoming", "emailCollectionOutgoing"];
]]>
</script>
@ -21,9 +21,18 @@
<titledbox orient="vertical">
<title><text value="&emailCollectiontitle.label;"/></title>
<html>&emailCollectiontext.label;</html>
<checkbox id="emailCollection" value="&emailCollectionenable.label;"
<checkbox id="emailCollection" value="&emailCollectionEnable.label;"
pref="true" preftype="bool" prefstring="mail.collect_email_address"
prefattribute="checked"/>
<box orient="vertical" autostretch="never" class="indent">
<html>&emailCollectionTypeText.label;</html>
<checkbox id="emailCollectionIncoming" value="&emailCollectionIncomingEnable.label;"
pref="true" preftype="bool" prefstring="mail.collect_email_address_incoming"
prefattribute="checked"/>
<checkbox id="emailCollectionOutgoing" value="&emailCollectionOutgoingEnable.label;"
pref="true" preftype="bool" prefstring="mail.collect_email_address_outgoing"
prefattribute="checked"/>
</box>
</titledbox>
<box orient="vertical" id="additional_addrbook_prefs"/>

View File

@ -35,7 +35,11 @@ Rights Reserved.
<!ENTITY oneMatch.label "If there is one match in your personal address books:">
<!ENTITY useAddress.label "Use the address and do not search in the directory">
<!ENTITY useAddress.accesskey "u">
<!ENTITY emailCollectionEnable.label "Enable Email Address Collection">
<!ENTITY emailCollectionIncomingEnable.label "Incoming Messages">
<!ENTITY emailCollectionOutgoingEnable.label "Outgoing Messages">
<!ENTITY emailCollectionTypeText.label "Save email addresses from my:">
<!ENTITY emailCollectiontitle.label "Email Address Collection">
<!ENTITY emailCollectiontext.label "Email Address Collection saves the email addresses from your incoming and/or outgoing mail and stores them in a local address book, Collected Addresses.">
<!ENTITY emailCollectionenable.label "Enable Email Address Collection">

View File

@ -166,7 +166,8 @@ var messageHeaderSink = {
currentHeaderData[lowerCaseHeaderName] = foo;
if (lowerCaseHeaderName == "from")
{
if (headerValue && abAddressCollector)
var collectIncoming = pref.GetBoolPref("mail.collect_email_address_incoming");
if (collectIncoming && headerValue && abAddressCollector)
abAddressCollector.collectUnicodeAddress(headerValue);
}

View File

@ -91,6 +91,7 @@ static NS_DEFINE_CID(kTXTToHTMLConvCID, MOZITXTTOHTMLCONV_CID);
#define PREF_MAIL_SEND_STRUCT "mail.send_struct"
#define PREF_MAIL_STRICTLY_MIME "mail.strictly_mime"
#define PREF_MAIL_MESSAGE_WARNING_SIZE "mailnews.message_warning_size"
#define PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING "mail.collect_email_address_outgoing"
#ifdef XP_MAC
#include "xp.h" // mac only
@ -2751,30 +2752,40 @@ nsMsgComposeAndSend::DeliverFileAsMail()
nsresult rv;
PRBool collectOutgoingAddresses = PR_TRUE;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs)
{
prefs->GetBoolPref(PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING,&collectOutgoingAddresses);
}
NS_WITH_SERVICE(nsIAbAddressCollecter, addressCollecter,
kCAddressCollecter, &rv);
if (!NS_SUCCEEDED(rv))
addressCollecter = nsnull;
PRBool collectAddresses = (collectOutgoingAddresses && addressCollecter);
PL_strcpy (buf, "");
buf2 = buf + PL_strlen (buf);
if (mCompFields->GetTo() && *mCompFields->GetTo())
{
PL_strcat (buf2, mCompFields->GetTo());
if (addressCollecter)
if (collectAddresses)
addressCollecter->CollectAddress(mCompFields->GetTo());
}
if (mCompFields->GetCc() && *mCompFields->GetCc()) {
if (*buf2) PL_strcat (buf2, ",");
PL_strcat (buf2, mCompFields->GetCc());
if (addressCollecter)
if (collectAddresses)
addressCollecter->CollectAddress(mCompFields->GetCc());
}
if (mCompFields->GetBcc() && *mCompFields->GetBcc()) {
if (*buf2) PL_strcat (buf2, ",");
PL_strcat (buf2, mCompFields->GetBcc());
if (addressCollecter)
if (collectAddresses)
addressCollecter->CollectAddress(mCompFields->GetBcc());
}

View File

@ -377,6 +377,8 @@ pref("mail.identity.default.stationery_folder","mailbox://nobody@Local Folders/T
pref("mail.update_compose_title_as_you_type", true);
pref("mail.collect_email_address", true);
pref("mail.collect_email_address_incoming", true);
pref("mail.collect_email_address_outgoing", true);
pref("mail.default_sendlater_uri","mailbox://nobody@Local Folders/Unsent Messages");
pref("mail.server.default.port", -1);

View File

@ -377,6 +377,8 @@ pref("mail.identity.default.stationery_folder","mailbox://nobody@Local Folders/T
pref("mail.update_compose_title_as_you_type", true);
pref("mail.collect_email_address", true);
pref("mail.collect_email_address_incoming", true);
pref("mail.collect_email_address_outgoing", true);
pref("mail.default_sendlater_uri","mailbox://nobody@Local Folders/Unsent Messages");
pref("mail.server.default.port", -1);