зеркало из https://github.com/mozilla/gecko-dev.git
Bug #230577 --> mail address autocompletion chooses three addresses from address book entries of a certain form.
Remove the header parser's code that breaks names based on spaces so it won't break: Scott, John Smith, Peter r=neil, sr=bienvenu
This commit is contained in:
Родитель
9fe00adc1f
Коммит
a1f2939862
|
@ -1052,16 +1052,14 @@ var gAutomatedAutoCompleteListener = null;
|
|||
|
||||
function parseAndAddAddresses(addressText, recipientType)
|
||||
{
|
||||
var fullNames;
|
||||
// strip any leading >> characters inserted by the autocomplete widget
|
||||
var strippedAddresses = addressText.replace(/.* >> /, "");
|
||||
|
||||
fullNames = addressText.split(',');
|
||||
numAddresses = fullNames.length;
|
||||
|
||||
for (index in fullNames)
|
||||
{
|
||||
// we want to eat leading and trailing white space...
|
||||
fullNames[index] = fullNames[index].replace(/^\s+|\s+$/g, "");
|
||||
}
|
||||
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);
|
||||
|
||||
if (numAddresses > 0)
|
||||
{
|
||||
|
@ -1071,7 +1069,7 @@ function parseAndAddAddresses(addressText, recipientType)
|
|||
if (!gAutomatedAutoCompleteListener)
|
||||
gAutomatedAutoCompleteListener = new AutomatedAutoCompleteHandler();
|
||||
|
||||
gAutomatedAutoCompleteListener.init(fullNames, numAddresses, recipientType);
|
||||
gAutomatedAutoCompleteListener.init(fullNames.value, numAddresses, recipientType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -763,44 +763,6 @@ static int msg_parse_Header_addresses (const char *line, char **names, char **ad
|
|||
{
|
||||
TRIM_WHITESPACE(addr_start, addr_out, 0);
|
||||
TRIM_WHITESPACE(name_start, name_out, 0);
|
||||
|
||||
/* Attempt to deal with the simple error case of a missing comma.
|
||||
* We can only really deal with this in the non-<> case.
|
||||
* If there is no name, and if the address doesn't contain
|
||||
* double-quotes, but the address does contain whitespace,
|
||||
* then assume that the whitespace is an address delimiter.
|
||||
*/
|
||||
if (!name_start || !*name_start)
|
||||
{
|
||||
char *s;
|
||||
char *space = 0;
|
||||
for (s = addr_start; s < addr_out; NEXT_CHAR(s))
|
||||
{
|
||||
if (*s == '\\')
|
||||
s++;
|
||||
else if (!space && nsCRT::IsAsciiSpace(*s))
|
||||
space = s;
|
||||
else if (*s == '\"')
|
||||
{
|
||||
space = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (space)
|
||||
{
|
||||
for (s = space; s < addr_out; NEXT_CHAR(s))
|
||||
{
|
||||
if (*s == '\\')
|
||||
s++;
|
||||
else if (nsCRT::IsAsciiSpace(*s))
|
||||
{
|
||||
*s = 0;
|
||||
*name_out++ = 0;
|
||||
addr_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now re-quote the names and addresses if necessary.
|
||||
|
|
Загрузка…
Ссылка в новой задаче