Bug 1249873 - Use makeMailboxObject() instead of hardcoded 'name <email>' strings in displayNameUtils.js. r=jorgk
This commit is contained in:
Родитель
3b264236f9
Коммит
4c92473d78
|
@ -86,7 +86,9 @@ function FormatDisplayName(aEmailAddress, aHeaderDisplayName, aContext, aCard)
|
|||
|
||||
// Make sure we have an unambiguous name if there are multiple identities
|
||||
if (MailServices.accounts.allIdentities.length > 1)
|
||||
displayName += " <" + identity.email + ">";
|
||||
displayName = MailServices.headerParser
|
||||
.makeMailboxObject(displayName,
|
||||
identity.email).toString();
|
||||
}
|
||||
|
||||
// If we don't have a card, refuse to generate a display name. Places calling
|
||||
|
@ -116,15 +118,16 @@ function FormatDisplayName(aEmailAddress, aHeaderDisplayName, aContext, aCard)
|
|||
function FormatDisplayNameList(aHeaderValue, aContext) {
|
||||
let addresses = MailServices.headerParser.parseDecodedHeader(aHeaderValue);
|
||||
if (addresses.length > 0) {
|
||||
let displayName = FormatDisplayName(addresses[0].email, addresses[0].name, aContext);
|
||||
let displayName = FormatDisplayName(addresses[0].email,
|
||||
addresses[0].name, aContext);
|
||||
if (displayName)
|
||||
return displayName;
|
||||
|
||||
// Construct default display.
|
||||
if (addresses[0].email) {
|
||||
return addresses[0].name ?
|
||||
addresses[0].name + " <" + addresses[0].email + ">" :
|
||||
addresses[0].email;
|
||||
return MailServices.headerParser
|
||||
.makeMailboxObject(addresses[0].name,
|
||||
addresses[0].email).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче