diff --git a/mail/base/content/msgHdrViewOverlay.js b/mail/base/content/msgHdrViewOverlay.js
index ad9c3be71039..46e6eb5f9ba6 100644
--- a/mail/base/content/msgHdrViewOverlay.js
+++ b/mail/base/content/msgHdrViewOverlay.js
@@ -121,12 +121,12 @@ var gMessageListeners = new Array;
// Our first view is the collapsed view. This is very light weight view of the data. We only show a couple
// fields.
var gCollapsedHeaderList = [ {name:"subject", outputFunction:updateHeaderValueInTextNode},
- {name:"from", useShortView:true, outputFunction:OutputEmailAddresses},
+ {name:"from", useToggle:true, useShortView:true, outputFunction:OutputEmailAddresses},
{name:"date", outputFunction:updateHeaderValueInTextNode}];
// We also have an expanded header view. This shows many of your more common (and useful) headers.
var gExpandedHeaderList = [ {name:"subject"},
- {name:"from", outputFunction:OutputEmailAddresses},
+ {name:"from", useToggle:true, outputFunction:OutputEmailAddresses},
{name:"sender", outputFunction:OutputEmailAddresses},
{name:"reply-to", outputFunction:OutputEmailAddresses},
{name:"date"},
@@ -167,11 +167,21 @@ var currentAttachments = new Array();
// headerListInfo --> entry from a header list.
function createHeaderEntry(prefix, headerListInfo)
{
+ var useShortView = false;
var partialIDName = prefix + headerListInfo.name;
this.enclosingBox = document.getElementById(partialIDName + 'Box');
this.textNode = document.getElementById(partialIDName + 'Value');
this.isValid = false;
+ if ("useShortView" in headerListInfo)
+ {
+ useShortView = headerListInfo.useShortView;
+ if (useShortView)
+ this.enclosingBox = this.textNode;
+ else
+ this.enclosingBox.emailAddressNode = this.textNode;
+ }
+
if ("useToggle" in headerListInfo)
{
this.useToggle = headerListInfo.useToggle;
@@ -185,13 +195,8 @@ function createHeaderEntry(prefix, headerListInfo)
else
this.useToggle = false;
- if ("useShortView" in headerListInfo)
- {
- this.useShortView = headerListInfo.useShortView;
- this.enclosingBox.emailAddressNode = this.textNode;
- }
- else
- this.useShortView = false;
+ if (this.textNode)
+ this.textNode.useShortView = useShortView;
if ("outputFunction" in headerListInfo)
this.outputFunction = headerListInfo.outputFunction;
@@ -359,8 +364,8 @@ var messageHeaderSink = {
processHeaders: function(headerNameEnumerator, headerValueEnumerator, dontCollectAddress)
{
this.onStartHeaders();
- var fromMailbox;
+ const kMailboxSeparator = ", ";
var index = 0;
while (headerNameEnumerator.hasMore())
{
@@ -414,11 +419,9 @@ var messageHeaderSink = {
}
else
currentHeaderData[lowerCaseHeaderName] = header;
+
if (lowerCaseHeaderName == "from")
{
- if (msgHeaderParser && header.headerValue)
- fromMailbox = msgHeaderParser.extractHeaderAddressMailboxes(null, header.headerValue);
-
if (header.headerValue)
{
try
@@ -430,12 +433,9 @@ var messageHeaderSink = {
.getService(Components.interfaces.nsIAbAddressCollecter);
gCollectAddress = header.headerValue;
- if (gCollectOutgoing)
- // collect, but only update existing cards, unknown preferred send format
- gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, false, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
- else
- // collect, and add card if doesn't exist, unknown preferred send format
- gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, true, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
+ // collect, add card if doesn't exist and gCollectOutgoing is set,
+ // otherwise only update existing cards, unknown preferred send format
+ gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, !gCollectOutgoing, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
}
}
catch(ex) {}
@@ -443,6 +443,16 @@ var messageHeaderSink = {
} // if lowerCaseHeaderName == "from"
} // while we have more headers to parse
+ if (("from" in currentHeaderData) && ("sender" in currentHeaderData) && msgHeaderParser)
+ {
+ var senderMailbox = kMailboxSeparator + msgHeaderParser.extractHeaderAddressMailboxes(null,
+ currentHeaderData.sender.headerValue) + kMailboxSeparator;
+ var fromMailboxes = kMailboxSeparator + msgHeaderParser.extractHeaderAddressMailboxes(null,
+ currentHeaderData.from.headerValue) + kMailboxSeparator;
+ if (fromMailboxes.indexOf(senderMailbox) >= 0)
+ delete currentHeaderData.sender;
+ }
+
this.onEndHeaders();
},
@@ -741,7 +751,6 @@ function createNewHeaderView(headerName)
this.enclosingBox = newHeader;
this.isValid = false;
this.useToggle = false;
- this.useShortView = false;
this.outputFunction = updateHeaderValue;
}
@@ -753,6 +762,7 @@ function UpdateMessageHeaders()
// iterate over each header we received and see if we have a matching entry in each
// header view table...
+ var headerName;
for (headerName in currentHeaderData)
{
var headerField = currentHeaderData[headerName];
@@ -870,17 +880,12 @@ function OutputNewsgroups(headerEntry, headerValue)
// extracts them one by one, linkifying each email address into a mailto url.
// Then we add the link-ified email address to the parentDiv passed in.
//
-// defaultParentDiv --> the div to add the link-ified email addresses into.
// emailAddresses --> comma separated list of the addresses for this header field
-// includeShortLongToggle --> true if you want to include the ability to toggle between short/long
-// address views for this header field. If true, then pass in a another div which is the div the long
-// view will be added too...
-// useShortView --> if true, we'll only generate the Name of the email address field instead of
-// showing the name + the email address.
function OutputEmailAddresses(headerEntry, emailAddresses)
{
- if ( !emailAddresses ) return;
+ if (!emailAddresses)
+ return;
if (msgHeaderParser)
{
@@ -896,19 +901,14 @@ function OutputEmailAddresses(headerEntry, emailAddresses)
// if we want to include short/long toggle views and we have a long view, always add it.
// if we aren't including a short/long view OR if we are and we haven't parsed enough
// addresses to reach the cutoff valve yet then add it to the default (short) div.
+ var address = {};
+ address.emailAddress = addresses.value[index];
+ address.fullAddress = fullNames.value[index];
+ address.displayName = names.value[index];
if (headerEntry.useToggle)
- {
- var address = {};
- address.emailAddress = addresses.value[index];
- address.fullAddress = fullNames.value[index];
- address.displayName = names.value[index];
headerEntry.enclosingBox.addAddressView(address);
- }
else
- {
- updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index],
- fullNames.value[index], names.value[index], headerEntry.useShortView);
- }
+ updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, address);
if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") {
setFromBuddyIcon(addresses.value[index]);
@@ -967,22 +967,16 @@ function setFromBuddyIcon(email)
fromBuddyIcon.setAttribute("src", "");
}
-function updateEmailAddressNode(emailAddressNode, emailAddress, fullAddress, displayName, useShortView)
+function updateEmailAddressNode(emailAddressNode, address)
{
- if (useShortView && displayName) {
- emailAddressNode.setAttribute("label", displayName);
- emailAddressNode.setAttribute("tooltiptext", emailAddress);
- } else {
- emailAddressNode.setAttribute("label", fullAddress);
- emailAddressNode.removeAttribute("tooltiptext");
- }
-
- emailAddressNode.setTextAttribute("emailAddress", emailAddress);
- emailAddressNode.setTextAttribute("fullAddress", fullAddress);
- emailAddressNode.setTextAttribute("displayName", displayName);
+ emailAddressNode.setAttribute("label", address.fullAddress || address.displayName);
+ emailAddressNode.removeAttribute("tooltiptext");
+ emailAddressNode.setTextAttribute("emailAddress", address.emailAddress);
+ emailAddressNode.setTextAttribute("fullAddress", address.fullAddress);
+ emailAddressNode.setTextAttribute("displayName", address.displayName);
if ("AddExtraAddressProcessing" in this)
- AddExtraAddressProcessing(emailAddress, emailAddressNode);
+ AddExtraAddressProcessing(address.emailAddress, emailAddressNode);
}
// thunderbird has smart logic for determining if we should show just the display name.
diff --git a/mail/base/content/msgHdrViewOverlay.xul b/mail/base/content/msgHdrViewOverlay.xul
index be1840159ec1..3442e03589cf 100644
--- a/mail/base/content/msgHdrViewOverlay.xul
+++ b/mail/base/content/msgHdrViewOverlay.xul
@@ -116,10 +116,9 @@
-
+
-
-
+
@@ -144,7 +143,7 @@
-
+
diff --git a/mailnews/base/resources/content/mailWidgets.xml b/mailnews/base/resources/content/mailWidgets.xml
index 07fb8c9ba3a7..c0d1cde101e8 100644
--- a/mailnews/base/resources/content/mailWidgets.xml
+++ b/mailnews/base/resources/content/mailWidgets.xml
@@ -683,9 +683,18 @@
entry from a header list.
function createHeaderEntry(prefix, headerListInfo)
{
+ var useShortView = false;
var partialIDName = prefix + headerListInfo.name;
this.enclosingBox = document.getElementById(partialIDName + 'Box');
this.textNode = document.getElementById(partialIDName + 'Value');
this.isValid = false;
+ if ("useShortView" in headerListInfo)
+ {
+ useShortView = headerListInfo.useShortView;
+ if (useShortView)
+ this.enclosingBox = this.textNode;
+ else
+ this.enclosingBox.emailAddressNode = this.textNode;
+ }
+
if ("useToggle" in headerListInfo)
{
this.useToggle = headerListInfo.useToggle;
@@ -171,13 +182,8 @@ function createHeaderEntry(prefix, headerListInfo)
else
this.useToggle = false;
- if ("useShortView" in headerListInfo)
- {
- this.useShortView = headerListInfo.useShortView;
- this.enclosingBox.emailAddressNode = this.textNode;
- }
- else
- this.useShortView = false;
+ if (this.textNode)
+ this.textNode.useShortView = useShortView;
if ("outputFunction" in headerListInfo)
this.outputFunction = headerListInfo.outputFunction;
@@ -323,6 +329,7 @@ var messageHeaderSink = {
{
this.onStartHeaders();
+ const kMailboxSeparator = ", ";
var index = 0;
while (headerNameEnumerator.hasMore())
{
@@ -377,31 +384,37 @@ var messageHeaderSink = {
if (lowerCaseHeaderName == "from")
{
- if (header.value)
+ if (header.headerValue)
{
- if ((gCollectIncoming && !dontCollectAddress) ||
- (gCollectNewsgroup && dontCollectAddress))
+ try
{
- if (!abAddressCollector)
- abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
+ if (!dontCollectAddress && (gCollectIncoming || gCollectNewsgroup || gCollectOutgoing))
+ {
+ if (!abAddressCollector)
+ abAddressCollector = Components.classes[abAddressCollectorContractID]
+ .getService(Components.interfaces.nsIAbAddressCollecter);
- gCollectAddress = header.headerValue;
- // collect, and add card if doesn't exist, unknown preferred send format
- gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, true, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
- }
- else if (gCollectOutgoing)
- {
- if (!abAddressCollector)
- abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
-
- // collect, but only update existing cards, unknown preferred send format
- gCollectAddress = header.headerValue;
- gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, false, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
+ gCollectAddress = header.headerValue;
+ // collect, add card if doesn't exist and gCollectOutgoing is set,
+ // otherwise only update existing cards, unknown preferred send format
+ gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, !gCollectOutgoing, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
+ }
}
+ catch(ex) {}
}
} // if lowerCaseHeaderName == "from"
} // while we have more headers to parse
+ if (("from" in currentHeaderData) && ("sender" in currentHeaderData) && msgHeaderParser)
+ {
+ var senderMailbox = kMailboxSeparator + msgHeaderParser.extractHeaderAddressMailboxes(null,
+ currentHeaderData.sender.headerValue) + kMailboxSeparator;
+ var fromMailboxes = kMailboxSeparator + msgHeaderParser.extractHeaderAddressMailboxes(null,
+ currentHeaderData.from.headerValue) + kMailboxSeparator;
+ if (fromMailboxes.indexOf(senderMailbox) >= 0)
+ delete currentHeaderData.sender;
+ }
+
this.onEndHeaders();
},
@@ -646,7 +659,6 @@ function createNewHeaderView(headerName)
this.enclosingBox = newHeader
this.isValid = false;
this.useToggle = false;
- this.useShortView = false;
this.outputFunction = updateHeaderValue;
}
@@ -658,6 +670,7 @@ function UpdateMessageHeaders()
// iterate over each header we received and see if we have a matching entry in each
// header view table...
+ var headerName;
for (headerName in currentHeaderData)
{
var headerField = currentHeaderData[headerName];
@@ -771,17 +784,12 @@ function OutputNewsgroups(headerEntry, headerValue)
// extracts them one by one, linkifying each email address into a mailto url.
// Then we add the link'ified email address to the parentDiv passed in.
//
-// defaultParentDiv --> the div to add the link-ified email addresses into.
// emailAddresses --> comma separated list of the addresses for this header field
-// includeShortLongToggle --> true if you want to include the ability to toggle between short/long
-// address views for this header field. If true, then pass in a another div which is the div the long
-// view will be added too...
-// useShortView --> if true, we'll only generate the Name of the email address field instead of
-// showing the name + the email address.
function OutputEmailAddresses(headerEntry, emailAddresses)
{
- if ( !emailAddresses ) return;
+ if (!emailAddresses)
+ return;
if (msgHeaderParser)
{
@@ -797,19 +805,14 @@ function OutputEmailAddresses(headerEntry, emailAddresses)
// if we want to include short/long toggle views and we have a long view, always add it.
// if we aren't including a short/long view OR if we are and we haven't parsed enough
// addresses to reach the cutoff valve yet then add it to the default (short) div.
+ var address = {};
+ address.emailAddress = addresses.value[index];
+ address.fullAddress = fullNames.value[index];
+ address.displayName = names.value[index];
if (headerEntry.useToggle)
- {
- var address = {};
- address.emailAddress = addresses.value[index];
- address.fullAddress = fullNames.value[index];
- address.displayName = names.value[index];
headerEntry.enclosingBox.addAddressView(address);
- }
else
- {
- updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, addresses.value[index],
- fullNames.value[index], names.value[index], headerEntry.useShortView);
- }
+ updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, address);
if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") {
setFromBuddyIcon(addresses.value[index]);
@@ -867,21 +870,16 @@ function setFromBuddyIcon(email)
fromBuddyIcon.setAttribute("src", "");
}
-function updateEmailAddressNode(emailAddressNode, emailAddress, fullAddress, displayName, useShortView)
+function updateEmailAddressNode(emailAddressNode, address)
{
- if (useShortView && displayName) {
- emailAddressNode.setAttribute("label", displayName);
- emailAddressNode.setAttribute("tooltiptext", emailAddress);
- } else {
- emailAddressNode.setAttribute("label", fullAddress || displayName);
- emailAddressNode.removeAttribute("tooltiptext");
- }
- emailAddressNode.setTextAttribute("emailAddress", emailAddress);
- emailAddressNode.setTextAttribute("fullAddress", fullAddress);
- emailAddressNode.setTextAttribute("displayName", displayName);
+ emailAddressNode.setAttribute("label", address.fullAddress || address.displayName);
+ emailAddressNode.removeAttribute("tooltiptext");
+ emailAddressNode.setTextAttribute("emailAddress", address.emailAddress);
+ emailAddressNode.setTextAttribute("fullAddress", address.fullAddress);
+ emailAddressNode.setTextAttribute("displayName", address.displayName);
if ("AddExtraAddressProcessing" in this)
- AddExtraAddressProcessing(emailAddress, emailAddressNode);
+ AddExtraAddressProcessing(address.emailAddress, emailAddressNode);
}
// createnewAttachmentInfo --> constructor method for creating new attachment object which goes into the
diff --git a/mailnews/base/resources/content/msgHdrViewOverlay.xul b/mailnews/base/resources/content/msgHdrViewOverlay.xul
index 8c15600ce75d..5f264bded354 100644
--- a/mailnews/base/resources/content/msgHdrViewOverlay.xul
+++ b/mailnews/base/resources/content/msgHdrViewOverlay.xul
@@ -129,10 +129,9 @@
-
+
-
-
+
@@ -161,7 +160,8 @@
-
+
+