Bug 1071476 - Comma in recipient name splits the recipient name to multiple fields in compose window r=IanN sr=Mnyromyr

a=IanN comm-aurora, comm-beta, comm-release CLOSED TREE
This commit is contained in:
Philip Chee 2015-02-01 01:12:35 +08:00
Родитель d71cbb9a4b
Коммит 6403d57655
1 изменённых файлов: 7 добавлений и 7 удалений

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

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource:///modules/mailServices.js");
top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
var inputElementType = "";
@ -984,13 +986,10 @@ function parseAndAddAddresses(addressText, recipientType)
// strip any leading >> characters inserted by the autocomplete widget
var strippedAddresses = addressText.replace(/.* >> /, "");
var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
var addresses = {};
var names = {};
var fullNames = {};
var numAddresses = hdrParser.parseHeadersWithArray(strippedAddresses, addresses, names, fullNames);
var addresses = MailServices.headerParser
.makeFromDisplayAddress(strippedAddresses);
if (numAddresses > 0)
if (addresses.length)
{
// we need to set up our own autocomplete session and search for results
@ -998,7 +997,8 @@ function parseAndAddAddresses(addressText, recipientType)
if (!gAutomatedAutoCompleteListener)
gAutomatedAutoCompleteListener = new AutomatedAutoCompleteHandler();
gAutomatedAutoCompleteListener.init(fullNames.value, numAddresses, recipientType);
gAutomatedAutoCompleteListener.init(addresses.map(addr => addr.toString()),
addresses.length, recipientType);
}
}