Bug 1390337 - Remove some unused functions in nsIMsgDBView and nsIMsgHeaderParser. r=jcranmer,jorgk
This commit is contained in:
Родитель
bc2c9a1382
Коммит
4eaa122240
|
@ -2942,7 +2942,7 @@ var gMessageNotificationBar = {
|
|||
let mdnAddr = MailServices.headerParser.extractHeaderAddressMailboxes(mdnHdr);
|
||||
let fromAddr = MailServices.headerParser.extractHeaderAddressMailboxes(fromHdr);
|
||||
|
||||
let authorName = MailServices.headerParser.extractHeaderAddressName(
|
||||
let authorName = MailServices.headerParser.extractFirstName(
|
||||
aMsgHeader.mime2DecodedAuthor) || aMsgHeader.author;
|
||||
|
||||
// If the return receipt doesn't go to the sender address, note that in the
|
||||
|
|
|
@ -318,8 +318,6 @@ interface nsIMsgDBView : nsISupports
|
|||
[retval, array, size_is(count)]
|
||||
out nsIMsgDBHdr headers);
|
||||
|
||||
/* @deprecated */ nsIMutableArray getMsgHdrsForSelection();
|
||||
|
||||
void getURIsForSelection(out unsigned long count, [retval, array, size_is(count)] out string uris);
|
||||
void getIndicesForSelection(out unsigned long count, [retval, array, size_is(count)] out nsMsgViewIndex indices);
|
||||
|
||||
|
|
|
@ -2773,22 +2773,6 @@ nsMsgDBView::GetSelectedMsgHdrs(uint32_t *aLength,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBView::GetMsgHdrsForSelection(nsIMutableArray **aResult)
|
||||
{
|
||||
nsMsgViewIndexArray selection;
|
||||
GetSelectedIndices(selection);
|
||||
uint32_t numIndices = selection.Length();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = GetHeadersFromSelection(selection.Elements(), numIndices, messages);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
messages.forget(aResult);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBView::GetURIsForSelection(uint32_t *length,
|
||||
char ***uris)
|
||||
|
|
|
@ -201,28 +201,7 @@ interface nsIMsgHeaderParser : nsISupports {
|
|||
* @return A comma-separated list of just the mailbox parts
|
||||
* of the email-addresses.
|
||||
*/
|
||||
/* @deprecated */ ACString extractHeaderAddressMailboxes(in ACString aLine);
|
||||
|
||||
/**
|
||||
* Given a string which contains a list of Header addresses, returns a
|
||||
* comma-separated list of just the `user name' portions. If any of
|
||||
* the addresses doesn't have a name, then the mailbox is used instead.
|
||||
*
|
||||
* @param aLine The header line to parse.
|
||||
* @return A comma-separated list of just the name parts
|
||||
* of the addresses.
|
||||
*/
|
||||
/* @deprecated */ AUTF8String extractHeaderAddressNames(in AUTF8String aLine);
|
||||
|
||||
/*
|
||||
* Like extractHeaderAddressNames, but only returns the first name in the
|
||||
* header if there is one. This function will return unquoted strings suitable
|
||||
* for display.
|
||||
*
|
||||
* @param aLine The header line to parse.
|
||||
* @return The first name found in the list.
|
||||
*/
|
||||
/* @deprecated */ AUTF8String extractHeaderAddressName(in AUTF8String aLine);
|
||||
ACString extractHeaderAddressMailboxes(in ACString aLine);
|
||||
|
||||
/**
|
||||
* Given a name and email address, produce a string that is suitable for
|
||||
|
|
|
@ -292,8 +292,8 @@ MimeAddressParser.prototype = {
|
|||
},
|
||||
|
||||
extractFirstName: function (aHeader) {
|
||||
let address = this.parseDecodedHeader(aHeader, false)[0];
|
||||
return address.name || address.email;
|
||||
let addresses = this.parseDecodedHeader(aHeader, false);
|
||||
return (addresses.length > 0) ? (addresses[0].name || addresses[0].email) : "";
|
||||
},
|
||||
|
||||
removeDuplicateAddresses: function (aAddrs, aOtherAddrs) {
|
||||
|
@ -416,17 +416,6 @@ MimeAddressParser.prototype = {
|
|||
return this.parseDecodedHeader(aLine).map(addr => addr.email).join(", ");
|
||||
},
|
||||
|
||||
extractHeaderAddressNames: function (aLine) {
|
||||
return this.parseDecodedHeader(aLine).map(addr => addr.name || addr.email)
|
||||
.join(", ");
|
||||
},
|
||||
|
||||
extractHeaderAddressName: function (aLine) {
|
||||
let addrs = this.parseDecodedHeader(aLine).map(addr =>
|
||||
addr.name || addr.email);
|
||||
return addrs.length == 0 ? "" : addrs[0];
|
||||
},
|
||||
|
||||
makeMimeAddress: function (aName, aEmail) {
|
||||
let object = this.makeMailboxObject(aName, aEmail);
|
||||
return this.makeMimeHeader([object]);
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
/*
|
||||
* Test suite for nsIMsgHeaderParser functions:
|
||||
* extractHeaderAddressMailboxes
|
||||
* extractHeaderAddressNames
|
||||
* extractHeaderAddressName
|
||||
* extractFirstName
|
||||
* parseDecodedHeader
|
||||
*/
|
||||
|
||||
ChromeUtils.import("resource:///modules/MailServices.jsm");
|
||||
|
||||
function run_test() {
|
||||
// In this array, the sub arrays consist of the following elements:
|
||||
// 0: input string
|
||||
// 0: input string (a comma separated list of recipients)
|
||||
// 1: expected output from extractHeaderAddressMailboxes
|
||||
// 2: expected output from extractHeaderAddressNames
|
||||
// 3: expected output from extractHeaderAddressName
|
||||
// 2: list of recipient names in the string
|
||||
// 3: first recipient name in the string
|
||||
const checks =
|
||||
[
|
||||
["abc@foo.invalid",
|
||||
|
@ -45,7 +45,7 @@ function run_test() {
|
|||
["\"Joe Q. Public\" <john.q.public@example.com>,Test <\"abc!x.yz\"@foo.invalid>, Test <test@[xyz!]>,\"Giant; \\\"Big\\\" Box\" <sysservices@example.net>",
|
||||
"john.q.public@example.com, \"abc!x.yz\"@foo.invalid, test@[xyz!], sysservices@example.net",
|
||||
"Joe Q. Public, Test, Test, Giant; \"Big\" Box",
|
||||
// extractHeaderAddressName returns unquoted names, hence the difference.
|
||||
// extractFirstName returns unquoted names, hence the difference.
|
||||
"Joe Q. Public" ],
|
||||
// Bug 549931
|
||||
["Undisclosed recipients:;",
|
||||
|
@ -58,18 +58,19 @@ function run_test() {
|
|||
let addresses = {}, names = {}, fullAddresses = {};
|
||||
MailServices.headerParser.parseHeadersWithArray("\" \"@a a;b", addresses, names, fullAddresses);
|
||||
|
||||
|
||||
// Test - empty strings
|
||||
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressMailboxes(""), "");
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressNames(""), "");
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressName(""), "");
|
||||
Assert.equal(MailServices.headerParser.extractFirstName(""), "");
|
||||
|
||||
// Test - extractHeaderAddressMailboxes
|
||||
|
||||
for (let i = 0; i < checks.length; ++i) {
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressMailboxes(checks[i][0]), checks[i][1]);
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressNames(checks[i][0]), checks[i][2]);
|
||||
Assert.equal(MailServices.headerParser.extractHeaderAddressName(checks[i][0]), checks[i][3]);
|
||||
let names = MailServices.headerParser.parseDecodedHeader(checks[i][0])
|
||||
.map(addr => addr.name || addr.email)
|
||||
.join(", ");
|
||||
Assert.equal(names, checks[i][2]);
|
||||
Assert.equal(MailServices.headerParser.extractFirstName(checks[i][0]), checks[i][3]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2617,7 +2617,7 @@ var gMessageNotificationBar =
|
|||
// update the allow remote content for sender string
|
||||
var mailbox = headerParser.extractHeaderAddressMailboxes(aMsgHdr.author);
|
||||
var emailAddress = mailbox || aMsgHdr.author;
|
||||
var displayName = headerParser.extractHeaderAddressName(aMsgHdr.author);
|
||||
var displayName = headerParser.extractFirstName(aMsgHdr.mime2DecodedAuthor);
|
||||
var brandName = this.mBrandBundle.getString("brandShortName");
|
||||
var remoteContentMsg = this.mStringBundle
|
||||
.getFormattedString("remoteContentBarMessage",
|
||||
|
@ -2685,8 +2685,8 @@ var gMessageNotificationBar =
|
|||
.extractHeaderAddressMailboxes(fromHdr);
|
||||
|
||||
var authorName = MailServices.headerParser
|
||||
.extractHeaderAddressName(
|
||||
aMsgHeader.mime2DecodedAuthor) || aMsgHeader.author;
|
||||
.extractFirstName(aMsgHeader.mime2DecodedAuthor)
|
||||
|| aMsgHeader.author;
|
||||
|
||||
var barMsg;
|
||||
// If the return receipt doesn't go to the sender address, note that in the
|
||||
|
|
Загрузка…
Ссылка в новой задаче