Fix for bug 34467. We need to put back the double quote in some case. Let the parser do the right job. R=alecf

This commit is contained in:
ducarroz%netscape.com 2000-05-04 22:16:25 +00:00
Родитель 995e95a588
Коммит 44310620a7
2 изменённых файлов: 34 добавлений и 30 удалений

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

@ -55,6 +55,7 @@ protected:
nsresult SetStringColumn(const char *str, mdb_token token);
nsresult SetUInt32Column(PRUint32 value, mdb_token token);
nsresult GetUInt32Column(mdb_token token, PRUint32 *pvalue, PRUint32 defaultValue = 0);
nsresult BuildRecipientsFromArray(const char *names, const char *addresses, PRUint32 numAddresses, nsCAutoString& allRecipients);
// reference and threading stuff.
nsresult ParseReferences(nsCString &references);

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

@ -398,18 +398,31 @@ NS_IMETHODIMP nsMsgHdr::GetRecipientsIsNewsgroup(PRBool *rfc822)
return NS_OK;
}
NS_IMETHODIMP nsMsgHdr::SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses)
nsresult nsMsgHdr::BuildRecipientsFromArray(const char *names, const char *addresses, PRUint32 numAddresses, nsCAutoString& allRecipients)
{
nsresult ret;
const char *curName = names;
const char *curAddress = addresses;
nsCAutoString allRecipients;
nsIMsgHeaderParser *headerParser = m_mdb->GetHeaderParser();
for (PRUint32 i = 0; i < numAddresses; i++)
for (PRUint32 i = 0; i < numAddresses; i++, curName += strlen(curName) + 1, curAddress += strlen(curAddress) + 1)
{
if (i > 0)
allRecipients += ", ";
if (headerParser)
{
char * fullAddress;
ret = headerParser->MakeFullAddress(nsnull, curName, curAddress, &fullAddress);
if (NS_SUCCEEDED(ret) && fullAddress)
{
allRecipients += fullAddress;
nsCRT::free(fullAddress);
continue;
}
}
// Just in case the parser failed...
if (strlen(curName))
{
allRecipients += curName;
@ -422,9 +435,20 @@ NS_IMETHODIMP nsMsgHdr::SetRecipientsArray(const char *names, const char *addres
allRecipients += curAddress;
allRecipients += '>';
}
curName += strlen(curName) + 1;
curAddress += strlen(curAddress) + 1;
}
return ret;
}
NS_IMETHODIMP nsMsgHdr::SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses)
{
nsresult ret;
nsCAutoString allRecipients;
ret = BuildRecipientsFromArray(names, addresses, numAddresses, allRecipients);
if (NS_FAILED(ret))
return ret;
ret = SetRecipients(allRecipients);
SetRecipientsIsNewsgroup(PR_TRUE);
return ret;
@ -439,33 +463,12 @@ NS_IMETHODIMP nsMsgHdr::SetCcList(const char *ccList)
NS_IMETHODIMP nsMsgHdr::SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses)
{
nsresult ret;
const char *curName = names;
const char *curAddress = addresses;
nsCAutoString allRecipients;
ret = BuildRecipientsFromArray(names, addresses, numAddresses, allRecipients);
if (NS_FAILED(ret))
return ret;
for (PRUint32 i = 0; i < numAddresses; i++)
{
if (i > 0)
allRecipients += ", ";
if (strlen(curName))
{
allRecipients += curName;
allRecipients += ' ';
}
if (strlen(curAddress))
{
if (strlen(curName))
allRecipients += '<';
else
allRecipients += "<";
allRecipients += curAddress;
allRecipients += '>';
}
curName += strlen(curName) + 1;
curAddress += strlen(curAddress) + 1;
}
ret = SetCcList(allRecipients);
return ret;
}