Fix for adding display name automatically on ABSync operation - Bug #: 1942 - r: xxxxx

git-svn-id: svn://10.0.0.236/trunk@76255 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rhp%netscape.com
2000-08-14 00:45:51 +00:00
parent 765bda40d2
commit 10f693c0e0

View File

@@ -2611,6 +2611,41 @@ nsAbSync::AddNewUsers()
if (mLastSyncFailed)
cardAlreadyThere = CardAlreadyInAddressBook(newCard, &localID, &tempCRC);
// Ok, now, lets be extra nice and see if we should build a display name for the
// card.
//
PRUnichar *tDispName = nsnull;
if (NS_SUCCEEDED(newCard->GetCardValue(kDisplayNameColumn, &tDispName)))
{
if ( (!tDispName) || (!*tDispName) )
{
PRUnichar *tFirstName = nsnull;
PRUnichar *tLastName = nsnull;
nsString tFullName;
newCard->GetCardValue(kFirstNameColumn, &tFirstName);
newCard->GetCardValue(kLastNameColumn, &tLastName);
if (tFirstName)
{
tFullName.Append(tFirstName);
if (tLastName)
tFullName.Append(NS_ConvertASCIItoUCS2(" "));
}
if (tLastName)
tFullName.Append(tLastName);
PR_FREEIF(tFirstName);
PR_FREEIF(tLastName);
// Ok, now we should add a display name...
newCard->SetDisplayName(tFullName.GetUnicode());
}
else
PR_FREEIF(tDispName);
}
// Ok, now we need to modify or add the card! ONLY IF ITS NOT THERE ALREADY
if (!cardAlreadyThere)
{