зеркало из https://github.com/mozilla/pjs.git
fixes for 232438, palm sync issues with mapping between moz ab's and palm categories, sr=mscott
This commit is contained in:
Родитель
118b529651
Коммит
97127db1e7
|
@ -46,6 +46,9 @@ typedef struct
|
|||
LPTSTR lpszABUrl;
|
||||
}nsMozABDesc, *lpnsMozABDesc;
|
||||
|
||||
const int kFirstTimeSyncDirFlag = 0x1;
|
||||
const int kIsPabDirFlag = 0x2;
|
||||
|
||||
// This structure defines the data fields for MozAB based on "nsIAbCard.idl"
|
||||
// This structure is used for interaction with the other AddressBook Apps
|
||||
// nsIAbCard changes should be reflected here to take care of those changes
|
||||
|
|
|
@ -422,7 +422,7 @@ long CALLBACK CondCfgDlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lPar
|
|||
else
|
||||
pCfgInfo->syncNew = eDoNothing;
|
||||
pCfgInfo->syncPref = (IsDlgButtonChecked(hWnd, IDC_MAKEDEFAULT))
|
||||
? ePermanentPreference : eTemporaryPreference;
|
||||
? ePermanentPreference : eTemporaryPreference;
|
||||
EndDialog(hWnd, 0);
|
||||
return TRUE;
|
||||
default:
|
||||
|
|
|
@ -97,13 +97,13 @@ CMozABConduitRecord::CMozABConduitRecord(nsABCOMCardStruct &rec)
|
|||
m_csAddress = (MozABPCManager::gUseHomeAddress)
|
||||
? rec.homeAddress : rec.workAddress;
|
||||
|
||||
m_csCity = (MozABPCManager::gUseHomeAddress) ? rec.homeCity : rec.workCity;
|
||||
m_csState = (MozABPCManager::gUseHomeAddress) ? rec.homeState : rec.workState;
|
||||
m_csZipCode = (MozABPCManager::gUseHomeAddress) ? rec.homeZipCode : rec.workZipCode;
|
||||
m_csCountry = (MozABPCManager::gUseHomeAddress) ? rec.homeCountry : rec.workCountry;
|
||||
// CONDUIT_LOG3(gFD, "\nCMozABConduitRecord::CMozABConduitRecord(nsABCOMCardStruct &rec) gUseHomeAddress = %s card home address = %s card work address = %s\n",
|
||||
// (MozABPCManager::gUseHomeAddress) ? "true" : "false", (char *) rec.homeAddress, (char *) rec.workAddress);
|
||||
m_dwDisplayPhone = rec.preferredPhoneNum;
|
||||
m_csCity = rec.homeCity;
|
||||
m_csState = rec.homeState;
|
||||
m_csZipCode = rec.homeZipCode;
|
||||
m_csCountry = rec.homeCountry;
|
||||
|
||||
m_csNote = rec.notes;
|
||||
|
||||
|
@ -164,7 +164,8 @@ eRecCompare CMozABConduitRecord::Compare(const CMozABConduitRecord &rec)
|
|||
(m_dwPhone3LabelID != rec.m_dwPhone3LabelID ) ||
|
||||
(m_dwPhone4LabelID != rec.m_dwPhone4LabelID ) ||
|
||||
(m_dwPhone5LabelID != rec.m_dwPhone5LabelID ) ||
|
||||
(m_dwDisplayPhone != rec.m_dwDisplayPhone ) ||
|
||||
// comment this out until we can match 4.x's displayPhone algorithm
|
||||
// (m_dwDisplayPhone != rec.m_dwDisplayPhone ) ||
|
||||
(m_csName != rec.m_csName ) ||
|
||||
(m_csFirst != rec.m_csFirst ) ||
|
||||
(m_csTitle != rec.m_csTitle ) ||
|
||||
|
@ -295,13 +296,37 @@ long CMozABConduitRecord::ConvertFromGeneric(CPalmRecord &rec)
|
|||
// (MozABPCManager::gUseHomeAddress) ? "true" : "false", (char *) m_nsCard.homeAddress, (char *) m_nsCard.workAddress, (char *) m_csAddress);
|
||||
}
|
||||
// City
|
||||
if (flags.city) COPY_FROM_GENERIC(m_csCity, m_nsCard.homeCity)
|
||||
if (flags.city)
|
||||
{
|
||||
if (MozABPCManager::gUseHomeAddress)
|
||||
COPY_FROM_GENERIC(m_csCity, m_nsCard.homeCity)
|
||||
else
|
||||
COPY_FROM_GENERIC(m_csCity, m_nsCard.workCity)
|
||||
}
|
||||
// State
|
||||
if (flags.state) COPY_FROM_GENERIC(m_csState, m_nsCard.homeState)
|
||||
if (flags.state)
|
||||
{
|
||||
if (MozABPCManager::gUseHomeAddress)
|
||||
COPY_FROM_GENERIC(m_csState, m_nsCard.homeState)
|
||||
else
|
||||
COPY_FROM_GENERIC(m_csState, m_nsCard.workState)
|
||||
}
|
||||
// ZipCode
|
||||
if (flags.zipCode) COPY_FROM_GENERIC(m_csZipCode, m_nsCard.homeZipCode)
|
||||
if (flags.zipCode)
|
||||
{
|
||||
if (MozABPCManager::gUseHomeAddress)
|
||||
COPY_FROM_GENERIC(m_csZipCode, m_nsCard.homeZipCode)
|
||||
else
|
||||
COPY_FROM_GENERIC(m_csZipCode, m_nsCard.workZipCode)
|
||||
}
|
||||
// Country
|
||||
if (flags.country) COPY_FROM_GENERIC(m_csCountry, m_nsCard.homeCountry)
|
||||
if (flags.country)
|
||||
{
|
||||
if (MozABPCManager::gUseHomeAddress)
|
||||
COPY_FROM_GENERIC(m_csCountry, m_nsCard.homeCountry)
|
||||
else
|
||||
COPY_FROM_GENERIC(m_csCountry, m_nsCard.workCountry)
|
||||
}
|
||||
// Title
|
||||
if (flags.title) COPY_FROM_GENERIC(m_csTitle, m_nsCard.jobTitle)
|
||||
// Customs
|
||||
|
|
|
@ -230,15 +230,15 @@ long CMozABConduitSync::GetRemoteDBInfo(int iIndex)
|
|||
return retval;
|
||||
}
|
||||
|
||||
BOOL CMozABConduitSync::CategoryNameMatches(CPString &catName, CPString &cutOffMozABName, CPString &mozABURL)
|
||||
BOOL CMozABConduitSync::CategoryNameMatches(CPString &catName, CPString &cutOffMozABName, BOOL isPAB)
|
||||
{
|
||||
if (!catName.CompareNoCase(cutOffMozABName.GetBuffer(0)))
|
||||
return TRUE;
|
||||
else
|
||||
return (!mozABURL.CompareNoCase(PERSONAL_ADDRBOOK_URL) && !catName.CompareNoCase("Personal"));
|
||||
return (isPAB && !catName.CompareNoCase("Personal"));
|
||||
}
|
||||
|
||||
BOOL CMozABConduitSync::CategoryExists(CPString &mozABName, CPString &mozABURL)
|
||||
BOOL CMozABConduitSync::CategoryExists(CPString &mozABName, BOOL isPAB)
|
||||
{
|
||||
CPCategory * pCategory = m_dbHH->GetFirstCategory();
|
||||
// Palm only allows 15 chars for category names.
|
||||
|
@ -250,7 +250,7 @@ BOOL CMozABConduitSync::CategoryExists(CPString &mozABName, CPString &mozABURL)
|
|||
while (pCategory)
|
||||
{
|
||||
CPString catName(pCategory->GetName());
|
||||
if (CategoryNameMatches(catName, cutOffName, mozABURL))
|
||||
if (CategoryNameMatches(catName, cutOffName, isPAB))
|
||||
return TRUE;
|
||||
// Process next category
|
||||
pCategory = m_dbHH->GetNextCategory();
|
||||
|
@ -278,7 +278,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
LONG * mozCatIndexList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABNameList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABUrlList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozIsFirstSyncList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozDirFlagsList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL neverDidPalmSyncBefore = TRUE; // 1st time palm sync?
|
||||
DWORD mozABIndex;
|
||||
|
||||
|
@ -288,7 +288,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
|
||||
CONDUIT_LOG0(gFD, "Getting moz AB List ... ");
|
||||
if(!retval)
|
||||
retval = sync->m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozIsFirstSyncList);
|
||||
retval = sync->m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozDirFlagsList);
|
||||
|
||||
if (retval)
|
||||
return retval;
|
||||
|
@ -303,7 +303,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
|
||||
// See if palm sync was performed before.
|
||||
for(mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
if (! mozIsFirstSyncList[mozABIndex])
|
||||
if (! (mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag))
|
||||
{
|
||||
neverDidPalmSyncBefore = FALSE;
|
||||
break;
|
||||
|
@ -313,7 +313,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
for (mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
{
|
||||
CONDUIT_LOG5(gFD, "Moz AB[%d] category index/synced=%d/%d, name= '%s', url= '%s'\n",
|
||||
mozABIndex, mozCatIndexList[mozABIndex], !mozIsFirstSyncList[mozABIndex],
|
||||
mozABIndex, mozCatIndexList[mozABIndex], ! (mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag),
|
||||
mozABNameList[mozABIndex]->GetBuffer(0), mozABUrlList[mozABIndex]->GetBuffer(0));
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
// See if the name has been changed on Palm side. Note that if both
|
||||
// Palm category and the corresponding moz addrbook are renamed then
|
||||
// Palm category name takes precedence.
|
||||
if (!sync->CategoryNameMatches(catName, cutOffName, *mozABUrlList[mozABIndex]))
|
||||
if (!sync->CategoryNameMatches(catName, cutOffName, mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
{
|
||||
abRenamed = TRUE;
|
||||
CONDUIT_LOG3(gFD, "Category index = %d, name = '%s' was renamed (from '%s') on Palm so do the same on moz\n",
|
||||
|
@ -362,7 +362,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
}
|
||||
|
||||
// if corresponding category exists but not synchronized before
|
||||
if(sync->CategoryNameMatches(catName, cutOffName, *mozABUrlList[mozABIndex]))
|
||||
if(sync->CategoryNameMatches(catName, cutOffName, mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
{
|
||||
retval = sync->m_dbHH->LoadAllRecordsInCategory(catIndex, &recordListHH, &recordCountHH);
|
||||
CONDUIT_LOG2(gFD, "Category index = %d, name = '%s' has not been synced before\n", catID, catName.GetBuffer(0));
|
||||
|
@ -420,7 +420,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
}
|
||||
// the MozAB is now synchronized
|
||||
if(!retval)
|
||||
mozIsFirstSyncList[mozABIndex] = FALSE;
|
||||
mozDirFlagsList[mozABIndex] &= ~kFirstTimeSyncDirFlag;
|
||||
// delete the PC recordList now that palm is updated
|
||||
if(recordListPC)
|
||||
free(recordListPC);
|
||||
|
@ -442,7 +442,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
if (abRenamed)
|
||||
{
|
||||
// We should not rename personal and collected address books here.
|
||||
if (mozABUrlList[mozABIndex]->CompareNoCase(PERSONAL_ADDRBOOK_URL) &&
|
||||
if (! (mozDirFlagsList[mozABIndex] & kIsPabDirFlag) &&
|
||||
mozABUrlList[mozABIndex]->CompareNoCase(COLLECTED_ADDRBOOK_URL))
|
||||
{
|
||||
CONDUIT_LOG0(gFD, " Renaming AB ... ");
|
||||
|
@ -502,7 +502,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
// and the case where Palm ABs have been deleted.
|
||||
for(mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
{
|
||||
if(mozIsFirstSyncList[mozABIndex] && !sync->CategoryExists(*mozABNameList[mozABIndex], *mozABUrlList[mozABIndex]))
|
||||
if((mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag) && !sync->CategoryExists(*mozABNameList[mozABIndex], mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
{
|
||||
CONDUIT_LOG3(gFD, "\nMoz AB[%d] category index = %d, name = '%s' doesn't exist on Palm so needs to be added to palm\n",
|
||||
mozABIndex, mozCatIndexList[mozABIndex], mozABNameList[mozABIndex]->GetBuffer(0));
|
||||
|
@ -514,7 +514,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
&recordCountPC, &recordListPC);
|
||||
if(!retval)
|
||||
{
|
||||
if (mozABUrlList[mozABIndex]->CompareNoCase(PERSONAL_ADDRBOOK_URL))
|
||||
if (! (mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
cat.SetName(mozABNameList[mozABIndex]->GetBuffer(0));
|
||||
else
|
||||
cat.SetName("Personal");
|
||||
|
@ -547,7 +547,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
|
||||
// the MozAB is now synchronized
|
||||
if(!retval)
|
||||
mozIsFirstSyncList[mozABIndex] = FALSE;
|
||||
mozDirFlagsList[mozABIndex] &= ~kFirstTimeSyncDirFlag;
|
||||
// delete the recordList now that palm is updated
|
||||
if(recordListPC)
|
||||
free(recordListPC);
|
||||
|
@ -573,7 +573,7 @@ DWORD WINAPI DoFastSync(LPVOID lpParameter)
|
|||
// Note: make sure the moz addrbook has been synced before to avoid the case
|
||||
// where early sync failed and we delete this un-synced addrbook by mistake.
|
||||
if (mozCatIndexList[mozABIndex] > -1 &&
|
||||
mozABUrlList[mozABIndex]->CompareNoCase(PERSONAL_ADDRBOOK_URL) &&
|
||||
! (mozDirFlagsList[mozABIndex] & kIsPabDirFlag) &&
|
||||
mozABUrlList[mozABIndex]->CompareNoCase(COLLECTED_ADDRBOOK_URL))
|
||||
{
|
||||
CONDUIT_LOG3(gFD, "\nMoz AB[%d] category index = %d, name = '%s' is removed on Palm and needs to be removed from moz\n",
|
||||
|
@ -647,7 +647,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
LONG * mozCatIndexList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABNameList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABUrlList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozIsFirstSyncList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozDirFlagsList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL neverDidPalmSyncBefore = TRUE; // 1st time palm sync?
|
||||
DWORD mozABIndex;
|
||||
|
||||
|
@ -657,7 +657,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
|
||||
CONDUIT_LOG0(gFD, "Getting moz AB List ... ");
|
||||
if(!retval)
|
||||
retval = m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozIsFirstSyncList);
|
||||
retval = m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozDirFlagsList);
|
||||
|
||||
CONDUIT_LOG1(gFD, "Done getting moz AB List. retval = %d\n", retval);
|
||||
if (retval)
|
||||
|
@ -672,7 +672,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
|
||||
// See if palm sync was performed before.
|
||||
for(mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
if (! mozIsFirstSyncList[mozABIndex])
|
||||
if (! (mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag))
|
||||
{
|
||||
neverDidPalmSyncBefore = FALSE;
|
||||
break;
|
||||
|
@ -682,7 +682,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
for (mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
{
|
||||
CONDUIT_LOG5(gFD, "Moz AB[%d] category index/synced=%d/%d, name= '%s', url= '%s'\n",
|
||||
mozABIndex, mozCatIndexList[mozABIndex], !mozIsFirstSyncList[mozABIndex],
|
||||
mozABIndex, mozCatIndexList[mozABIndex], !(mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag),
|
||||
mozABNameList[mozABIndex]->GetBuffer(0), mozABUrlList[mozABIndex]->GetBuffer(0));
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
// See if the name has been changed on Palm side. Note that if both
|
||||
// Palm category and the corresponding moz addrbook are renamed then
|
||||
// Palm category name takes precedence.
|
||||
if (!CategoryNameMatches(catName, cutOffName, *mozABUrlList[mozABIndex]))
|
||||
if (!CategoryNameMatches(catName, cutOffName, mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
{
|
||||
abRenamed = TRUE;
|
||||
CONDUIT_LOG3(gFD, "Category index = %d, name = '%s' was renamed (from '%s') on Palm so do the same on moz\n",
|
||||
|
@ -730,7 +730,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
break;
|
||||
}
|
||||
// if corresponding category exists
|
||||
if (CategoryNameMatches(catName, cutOffName, *mozABUrlList[mozABIndex]))
|
||||
if (CategoryNameMatches(catName, cutOffName, mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
{
|
||||
retval = m_dbHH->LoadAllRecordsInCategory(catIndex, &recordListHH, &recordCountHH);
|
||||
CONDUIT_LOG3(gFD, "Category index = %d, name = '%s' matches moz ab %s\n", catID, catName.GetBuffer(0), mozABUrlList[mozABIndex]->GetBuffer(0));
|
||||
|
@ -758,7 +758,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
CONDUIT_LOG1(gFD, "Done creating new moz AB. retval=%d.\n", retval);
|
||||
// the MozAB is now synchronized
|
||||
if(!retval)
|
||||
mozIsFirstSyncList[mozABIndex] = FALSE;
|
||||
mozDirFlagsList[mozABIndex] &= ~kFirstTimeSyncDirFlag;
|
||||
// delete the PC recordList now that palm is updated
|
||||
if(recordListPC)
|
||||
free(recordListPC);
|
||||
|
@ -774,7 +774,7 @@ long CMozABConduitSync::CopyHHtoPC()
|
|||
if (abRenamed)
|
||||
{
|
||||
// We should not rename personal and collected address books here.
|
||||
if (mozABUrlList[mozABIndex]->CompareNoCase(PERSONAL_ADDRBOOK_URL) &&
|
||||
if (! (mozDirFlagsList[mozABIndex] & kIsPabDirFlag) &&
|
||||
mozABUrlList[mozABIndex]->CompareNoCase(COLLECTED_ADDRBOOK_URL))
|
||||
{
|
||||
CONDUIT_LOG0(gFD, " Renaming AB ... ");
|
||||
|
@ -849,7 +849,7 @@ long CMozABConduitSync::CopyPCtoHH()
|
|||
LONG * mozCatIndexList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABNameList = NULL; // freed by MSCOM/Mozilla
|
||||
CPString ** mozABUrlList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozIsFirstSyncList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL * mozDirFlagsList = NULL; // freed by MSCOM/Mozilla
|
||||
BOOL neverDidPalmSyncBefore = TRUE; // 1st time palm sync?
|
||||
DWORD mozABIndex;
|
||||
|
||||
|
@ -859,7 +859,7 @@ long CMozABConduitSync::CopyPCtoHH()
|
|||
|
||||
CONDUIT_LOG0(gFD, "Getting moz AB List ... ");
|
||||
if(!retval)
|
||||
retval = m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozIsFirstSyncList);
|
||||
retval = m_dbPC->GetPCABList(&mozABCount, &mozCatIndexList, &mozABNameList, &mozABUrlList, &mozDirFlagsList);
|
||||
|
||||
if (retval)
|
||||
return retval;
|
||||
|
@ -874,7 +874,7 @@ long CMozABConduitSync::CopyPCtoHH()
|
|||
|
||||
// See if palm sync was performed before.
|
||||
for(mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
if (! mozIsFirstSyncList[mozABIndex])
|
||||
if (! (mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag))
|
||||
{
|
||||
neverDidPalmSyncBefore = FALSE;
|
||||
break;
|
||||
|
@ -884,7 +884,7 @@ long CMozABConduitSync::CopyPCtoHH()
|
|||
for (mozABIndex=0; mozABIndex<mozABCount; mozABIndex++)
|
||||
{
|
||||
CONDUIT_LOG5(gFD, "Moz AB[%d] category index/synced=%d/%d, name= '%s', url= '%s'\n",
|
||||
mozABIndex, mozCatIndexList[mozABIndex], !mozIsFirstSyncList[mozABIndex],
|
||||
mozABIndex, mozCatIndexList[mozABIndex], !(mozDirFlagsList[mozABIndex] & kFirstTimeSyncDirFlag),
|
||||
mozABNameList[mozABIndex]->GetBuffer(0), mozABUrlList[mozABIndex]->GetBuffer(0));
|
||||
}
|
||||
|
||||
|
@ -925,10 +925,10 @@ long CMozABConduitSync::CopyPCtoHH()
|
|||
&recordCountPC, &recordListPC);
|
||||
if(!retval)
|
||||
{
|
||||
if (mozABUrlList[mozABIndex]->CompareNoCase(PERSONAL_ADDRBOOK_URL))
|
||||
cat.SetName(mozABNameList[mozABIndex]->GetBuffer(0));
|
||||
else
|
||||
if ((mozDirFlagsList[mozABIndex] & kIsPabDirFlag))
|
||||
cat.SetName("Personal");
|
||||
else
|
||||
cat.SetName(mozABNameList[mozABIndex]->GetBuffer(0));
|
||||
CONDUIT_LOG1(gFD, " Creating new Palm AB with %d record(s) ... ", recordCountPC);
|
||||
retval = m_dbHH->AddCategory(cat);
|
||||
CONDUIT_LOG2(gFD, "Done creating new Palm AB, new category index=%d. retval=%d.\n", cat.GetIndex(), retval);
|
||||
|
|
|
@ -97,8 +97,8 @@ protected:
|
|||
long CopyHHtoPC();
|
||||
long CopyPCtoHH();
|
||||
// utility methods
|
||||
BOOL CategoryExists(CPString &mozABName, CPString &mozABURL);
|
||||
BOOL CategoryNameMatches(CPString &catName, CPString &cutOffMozABName, CPString &mozABURL);
|
||||
BOOL CategoryExists(CPString &mozABName, BOOL isPAB);
|
||||
BOOL CategoryNameMatches(CPString &catName, CPString &cutOffMozABName, BOOL isPAB);
|
||||
|
||||
private:
|
||||
CSyncProperties m_rSyncProperties;
|
||||
|
|
|
@ -94,7 +94,7 @@ BOOL MozABPCManager::InitMozPalmSyncInstance(IPalmSync **aRetValue)
|
|||
}
|
||||
|
||||
// this function allocates the list as well as the strings, caller should free list and delete strings
|
||||
long MozABPCManager::GetPCABList(DWORD * pCategoryCount, LONG ** pCategoryIndexList, CPString *** pCategoryNameList, CPString *** pCategoryUrlList, BOOL ** pIsFirstTimeSyncList)
|
||||
long MozABPCManager::GetPCABList(DWORD * pCategoryCount, LONG ** pCategoryIndexList, CPString *** pCategoryNameList, CPString *** pCategoryUrlList, BOOL ** pDirFlags)
|
||||
{
|
||||
lpnsMozABDesc mozABNameList=NULL;
|
||||
|
||||
|
@ -108,7 +108,7 @@ long MozABPCManager::GetPCABList(DWORD * pCategoryCount, LONG ** pCategoryIndexL
|
|||
|
||||
// get the ABList
|
||||
HRESULT hres = pNsPalmSync->nsGetABList(FALSE, &dwMozABCount,
|
||||
&mozABNameList, pCategoryIndexList, pIsFirstTimeSyncList);
|
||||
&mozABNameList, pCategoryIndexList, pDirFlags);
|
||||
if (hres != S_OK) {
|
||||
retval = (long) hres;
|
||||
return retval;
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
MozABPCManager() { }
|
||||
~MozABPCManager() { }
|
||||
|
||||
// this will return the list of ABs in Mozilla and if they were synced before
|
||||
// this will return the list of ABs in Mozilla and some flags, including if they were synced before
|
||||
long GetPCABList(DWORD * pCategoryCount, LONG ** pCategoryIndexList,
|
||||
CPString *** pCategoryNameList, CPString *** pCategoryURLList, BOOL ** pIsFirstTimeSyncList);
|
||||
CPString *** pCategoryNameList, CPString *** pCategoryURLList, BOOL ** pDirFlags);
|
||||
// this will update a Mozilla AB with updated Palm records and
|
||||
// return updated records in a Mozilla AB after the last sync
|
||||
// this will take care of first time sync also in which case
|
||||
|
|
|
@ -127,9 +127,9 @@ STDMETHODIMP CPalmSyncImp::IsValid()
|
|||
|
||||
// Get the list of Address Books for the currently logged in user profile
|
||||
STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
||||
lpnsMozABDesc * aABList, long ** aABCatIndexList, BOOL ** aFirstTimeSyncList)
|
||||
lpnsMozABDesc * aABList, long ** aABCatIndexList, BOOL ** aDirFlagsList)
|
||||
{
|
||||
if (!aABListCount || !aABList || !aABCatIndexList ||!aFirstTimeSyncList)
|
||||
if (!aABListCount || !aABList || !aABCatIndexList ||!aDirFlagsList)
|
||||
return E_FAIL;
|
||||
*aABListCount = 0;
|
||||
|
||||
|
@ -187,12 +187,12 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
|||
return E_FAIL; // should not happen but just in case.
|
||||
|
||||
lpnsMozABDesc serverDescList = (lpnsMozABDesc) CoTaskMemAlloc(sizeof(nsMozABDesc) * count);
|
||||
BOOL *firstTimeSyncList = (BOOL *) CoTaskMemAlloc(sizeof(BOOL) * count);
|
||||
BOOL *dirFlagsList = (BOOL *) CoTaskMemAlloc(sizeof(BOOL) * count);
|
||||
long *catIndexList = (long *) CoTaskMemAlloc(sizeof(long) * count);
|
||||
|
||||
*aABListCount = count;
|
||||
*aABList = serverDescList;
|
||||
*aFirstTimeSyncList = firstTimeSyncList;
|
||||
*aDirFlagsList = dirFlagsList;
|
||||
*aABCatIndexList = catIndexList;
|
||||
|
||||
directory->GetChildNodes(getter_AddRefs(subDirectories)); // reset enumerator
|
||||
|
@ -264,8 +264,14 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
|||
}
|
||||
serverDescList++;
|
||||
|
||||
*firstTimeSyncList = (palmSyncTimeStamp <= 0);
|
||||
firstTimeSyncList++;
|
||||
PRUint32 dirFlag = 0;
|
||||
if (palmSyncTimeStamp <= 0)
|
||||
dirFlag |= kFirstTimeSyncDirFlag;
|
||||
// was this the pab?
|
||||
if (prefName.Equals("ldap_2.servers.pab.disablePalmSync"))
|
||||
dirFlag |= kIsPabDirFlag;
|
||||
*dirFlagsList = (BOOL) dirFlag;
|
||||
dirFlagsList++;
|
||||
|
||||
*catIndexList = palmCategoryIndex;
|
||||
catIndexList++;
|
||||
|
@ -275,7 +281,7 @@ STDMETHODIMP CPalmSyncImp::nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
|||
|
||||
// assign member variables to the beginning of the list
|
||||
serverDescList = *aABList;
|
||||
firstTimeSyncList = *aFirstTimeSyncList;
|
||||
dirFlagsList = *aDirFlagsList;
|
||||
catIndexList = *aABCatIndexList;
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
|
|
|
@ -67,7 +67,7 @@ public :
|
|||
|
||||
// Get the list of Address Books for the currently logged in user profile
|
||||
STDMETHODIMP nsGetABList(BOOL aIsUnicode, short * aABListCount,
|
||||
lpnsMozABDesc * aABList, long ** aABCatIndexList, BOOL ** aFirstTimeSyncList);
|
||||
lpnsMozABDesc * aABList, long ** aABCatIndexList, BOOL ** aDirFlags);
|
||||
|
||||
// Synchronize the Address Book represented by the aCategoryIndex and/or corresponding aABName in Mozilla
|
||||
STDMETHODIMP nsSynchronizeAB(BOOL aIsUnicode, long aCategoryIndex, long aCategoryId, LPTSTR aABName,
|
||||
|
|
|
@ -116,7 +116,11 @@ NS_IMETHODIMP nsAbIPCCard::Copy(nsIAbCard *srcCard)
|
|||
srcCard->GetLastModifiedDate(&lastModifiedDate);
|
||||
mStatus = (lastModifiedDate) ? ATTR_MODIFIED : ATTR_NEW;
|
||||
|
||||
return nsAbCardProperty::Copy(srcCard);
|
||||
rv = nsAbCardProperty::Copy(srcCard);
|
||||
// do we need to join the work and home addresses?
|
||||
// or split them?
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsAbIPCCard::Copy(nsABCOMCardStruct * srcCard)
|
||||
|
@ -169,7 +173,7 @@ nsresult nsAbIPCCard::Copy(nsABCOMCardStruct * srcCard)
|
|||
SetCellularNumber(str.get());
|
||||
|
||||
// See if home address contains multiple lines.
|
||||
SplitHomeAddresses(srcCard, PR_TRUE);
|
||||
SplitHomeAndWorkAddresses(srcCard, PR_TRUE);
|
||||
|
||||
CONVERT_CRLF_TO_SPACE(str, srcCard->homeCity);
|
||||
SetHomeCity(str.get());
|
||||
|
@ -183,12 +187,6 @@ nsresult nsAbIPCCard::Copy(nsABCOMCardStruct * srcCard)
|
|||
CONVERT_CRLF_TO_SPACE(str, srcCard->homeCountry);
|
||||
SetHomeCountry(str.get());
|
||||
|
||||
CONVERT_CRLF_TO_SPACE(str, srcCard->workAddress);
|
||||
SetWorkAddress(str.get());
|
||||
|
||||
CONVERT_CRLF_TO_SPACE(str, srcCard->workAddress2);
|
||||
SetWorkAddress2(str.get());
|
||||
|
||||
CONVERT_CRLF_TO_SPACE(str, srcCard->workCity);
|
||||
SetWorkCity(str.get());
|
||||
|
||||
|
@ -294,7 +292,7 @@ nsresult nsAbIPCCard::ConvertToUnicodeAndCopy(nsABCOMCardStruct * srcCard)
|
|||
SetCellularNumber(str.get());
|
||||
|
||||
// See if home address contains multiple lines.
|
||||
SplitHomeAddresses(srcCard, PR_FALSE);
|
||||
SplitHomeAndWorkAddresses(srcCard, PR_FALSE);
|
||||
|
||||
CONVERT_ASSIGNTO_UNICODE(str, srcCard->homeCity, PR_TRUE);
|
||||
SetHomeCity(str.get());
|
||||
|
@ -308,12 +306,6 @@ nsresult nsAbIPCCard::ConvertToUnicodeAndCopy(nsABCOMCardStruct * srcCard)
|
|||
CONVERT_ASSIGNTO_UNICODE(str, srcCard->homeCountry, PR_TRUE);
|
||||
SetHomeCountry(str.get());
|
||||
|
||||
CONVERT_ASSIGNTO_UNICODE(str, srcCard->workAddress, PR_TRUE);
|
||||
SetWorkAddress(str.get());
|
||||
|
||||
CONVERT_ASSIGNTO_UNICODE(str, srcCard->workAddress2, PR_TRUE);
|
||||
SetWorkAddress2(str.get());
|
||||
|
||||
CONVERT_ASSIGNTO_UNICODE(str, srcCard->workCity, PR_TRUE);
|
||||
SetWorkCity(str.get());
|
||||
|
||||
|
@ -372,31 +364,54 @@ nsresult nsAbIPCCard::ConvertToUnicodeAndCopy(nsABCOMCardStruct * srcCard)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsAbIPCCard::SplitHomeAddresses(nsABCOMCardStruct * card, PRBool isUnicode)
|
||||
void nsAbIPCCard::SplitAddresses(PRBool isUnicode, LPTSTR homeAddress, LPTSTR workAddress)
|
||||
{
|
||||
// If the address contains more than one line then split it into two
|
||||
// (since moz only allows two address lines) and make sure all CRLFs
|
||||
// are converted to spaces in the 2nd address line. Lines are ended
|
||||
// with CRLF (done by moz conduit) and 'card->homeAddress2 is never used.
|
||||
PRInt32 idx;
|
||||
nsAutoString str;
|
||||
nsAutoString homeAddressStr;
|
||||
nsAutoString workAddressStr;
|
||||
if (isUnicode)
|
||||
str.Assign(card->homeAddress);
|
||||
else
|
||||
CONVERT_ASSIGNTO_UNICODE(str, card->homeAddress, PR_FALSE);
|
||||
|
||||
nsAutoString addr1, addr2;
|
||||
if ((idx = str.Find( "\x0D\x0A")) != kNotFound)
|
||||
{
|
||||
str.Left(addr1, idx);
|
||||
str.Right( addr2, str.Length() - idx - 2); // need to minus string lenght of CRLF.
|
||||
homeAddressStr.Assign(homeAddress);
|
||||
workAddressStr.Assign(workAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONVERT_ASSIGNTO_UNICODE(homeAddressStr, homeAddress, PR_FALSE);
|
||||
CONVERT_ASSIGNTO_UNICODE(workAddressStr, workAddress, PR_FALSE);
|
||||
}
|
||||
nsAutoString addr1, addr2;
|
||||
if ((idx = homeAddressStr.Find( "\x0D\x0A")) != kNotFound)
|
||||
{
|
||||
homeAddressStr.Left(addr1, idx);
|
||||
homeAddressStr.Right( addr2, homeAddressStr.Length() - idx - 2); // need to minus string lenght of CRLF.
|
||||
addr2.ReplaceSubstring(NS_LITERAL_STRING("\x0D\x0A").get(),NS_LITERAL_STRING(", ").get());
|
||||
|
||||
SetHomeAddress(addr1.get());
|
||||
SetHomeAddress2(addr2.get());
|
||||
}
|
||||
else
|
||||
SetHomeAddress(str.get());
|
||||
SetHomeAddress(homeAddressStr.get());
|
||||
if ((idx = workAddressStr.Find( "\x0D\x0A")) != kNotFound)
|
||||
{
|
||||
workAddressStr.Left(addr1, idx);
|
||||
workAddressStr.Right( addr2, workAddressStr.Length() - idx - 2); // need to minus string lenght of CRLF.
|
||||
addr2.ReplaceSubstring(NS_LITERAL_STRING("\x0D\x0A").get(),NS_LITERAL_STRING(", ").get());
|
||||
|
||||
SetWorkAddress(addr1.get());
|
||||
SetWorkAddress2(addr2.get());
|
||||
}
|
||||
else
|
||||
SetWorkAddress(workAddressStr.get());
|
||||
}
|
||||
|
||||
void nsAbIPCCard::SplitHomeAndWorkAddresses(nsABCOMCardStruct * card, PRBool isUnicode)
|
||||
{
|
||||
// If the address contains more than one line then split it into two
|
||||
// (since moz only allows two address lines) and make sure all CRLFs
|
||||
// are converted to spaces in the 2nd address line. Lines are ended
|
||||
// with CRLF (done by moz conduit). So card->homeAddress2
|
||||
// and card->workAddress2 are never used.
|
||||
SplitAddresses(isUnicode, card->homeAddress, card->workAddress);
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,9 +422,18 @@ PRBool nsAbIPCCard::EqualsAfterUnicodeConversion(nsABCOMCardStruct * card, nsStr
|
|||
|
||||
// convert to Unicode first
|
||||
nsAbIPCCard card1(card, PR_FALSE);
|
||||
card1.SplitAddresses(PR_FALSE, card->homeAddress, card->workAddress);
|
||||
nsABCOMCardStruct * newCard = new nsABCOMCardStruct;
|
||||
// get the unicode nsABCOMCardStruct and compare
|
||||
card1.GetABCOMCardStruct(PR_TRUE, newCard);
|
||||
// want to split newCard home and work address
|
||||
|
||||
// I think this leaks...need to free up the original values
|
||||
card1.CopyValue(PR_TRUE, m_HomeAddress, &newCard->homeAddress);
|
||||
card1.CopyValue(PR_TRUE, m_HomeAddress2, &newCard->homeAddress2);
|
||||
card1.CopyValue(PR_TRUE, m_WorkAddress, &newCard->workAddress);
|
||||
card1.CopyValue(PR_TRUE, m_WorkAddress2, &newCard->workAddress2);
|
||||
|
||||
PRBool ret = Equals(newCard, differingAttrs);
|
||||
delete newCard;
|
||||
return ret;
|
||||
|
@ -456,6 +480,7 @@ PRBool nsAbIPCCard::Equals(nsABCOMCardStruct * card, nsStringArray & differingAt
|
|||
if(card->cellularNumber)
|
||||
if (Compare(nsDependentString(card->cellularNumber), m_CellularNumber, nsCaseInsensitiveStringComparator()))
|
||||
differingAttrs.AppendString(NS_LITERAL_STRING(kCellularColumn));
|
||||
// card has home and work addresses joined, but "this" has them split
|
||||
if(card->homeAddress)
|
||||
if (Compare(nsDependentString(card->homeAddress), m_HomeAddress, nsCaseInsensitiveStringComparator()))
|
||||
differingAttrs.AppendString(NS_LITERAL_STRING(kHomeAddressColumn));
|
||||
|
@ -474,6 +499,7 @@ PRBool nsAbIPCCard::Equals(nsABCOMCardStruct * card, nsStringArray & differingAt
|
|||
if(card->homeCountry)
|
||||
if (Compare(nsDependentString(card->homeCountry), m_HomeCountry, nsCaseInsensitiveStringComparator()))
|
||||
differingAttrs.AppendString(NS_LITERAL_STRING(kHomeCountryColumn));
|
||||
// card->workAddress is Joined, m_workAddress and m_workAddress2 are split
|
||||
if(card->workAddress)
|
||||
if (Compare(nsDependentString(card->workAddress), m_WorkAddress, nsCaseInsensitiveStringComparator()))
|
||||
differingAttrs.AppendString(NS_LITERAL_STRING(kWorkAddressColumn));
|
||||
|
@ -616,6 +642,7 @@ NS_IMETHODIMP nsAbIPCCard::Equals(nsIAbCard *card, PRBool *_retval)
|
|||
if (Compare(str, m_HomeCountry, nsCaseInsensitiveStringComparator()))
|
||||
return NS_OK;
|
||||
|
||||
// both card and this have their addresses split, which is correct
|
||||
card->GetWorkAddress(getter_Copies(str));
|
||||
if (Compare(str, m_WorkAddress, nsCaseInsensitiveStringComparator()))
|
||||
return NS_OK;
|
||||
|
@ -828,13 +855,11 @@ nsresult nsAbIPCCard::GetABCOMCardStruct(PRBool isUnicode, nsABCOMCardStruct * c
|
|||
CopyValue(isUnicode, m_PagerNumber, &card->pagerNumber);
|
||||
CopyValue(isUnicode, m_CellularNumber, &card->cellularNumber);
|
||||
// See if home address contains multiple lines.
|
||||
JoinHomeAddresses(isUnicode, card);
|
||||
JoinHomeAndWorkAddresses(isUnicode, card);
|
||||
CopyValue(isUnicode, m_HomeCity, &card->homeCity);
|
||||
CopyValue(isUnicode, m_HomeState, &card->homeState);
|
||||
CopyValue(isUnicode, m_HomeZipCode, &card->homeZipCode);
|
||||
CopyValue(isUnicode, m_HomeCountry, &card->homeCountry);
|
||||
CopyValue(isUnicode, m_WorkAddress, &card->workAddress);
|
||||
CopyValue(isUnicode, m_WorkAddress2, &card->workAddress2);
|
||||
CopyValue(isUnicode, m_WorkCity, &card->workCity);
|
||||
CopyValue(isUnicode, m_WorkState, &card->workState);
|
||||
CopyValue(isUnicode, m_WorkZipCode, &card->workZipCode);
|
||||
|
@ -857,9 +882,9 @@ nsresult nsAbIPCCard::GetABCOMCardStruct(PRBool isUnicode, nsABCOMCardStruct * c
|
|||
card->preferMailFormat = m_PreferMailFormat;
|
||||
card->addressToUse = CPalmSyncImp::nsUseABHomeAddressForPalmAddress(); // 0 == home, 1 == work
|
||||
if (CPalmSyncImp::nsPreferABHomePhoneForPalmPhone())
|
||||
card->preferredPhoneNum = (m_HomePhone.IsEmpty()) ? 1 : 2;
|
||||
card->preferredPhoneNum = (m_HomePhone.IsEmpty()) ? (m_WorkPhone.IsEmpty() ? 4 : 1) : 2;
|
||||
else
|
||||
card->preferredPhoneNum = (m_WorkPhone.IsEmpty()) ? 2 : 1;
|
||||
card->preferredPhoneNum = (m_WorkPhone.IsEmpty()) ? 2 : (m_WorkPhone.IsEmpty() ? 4 : 1);
|
||||
card->isMailList = m_IsMailList;
|
||||
// Can't use ToNewCString() call here becasue MSCOM will complaint about
|
||||
// memory deallocation (ie, NdrPointerFree()) use CoTaskMemAlloc() instead.
|
||||
|
@ -877,13 +902,13 @@ nsresult nsAbIPCCard::GetABCOMCardStruct(PRBool isUnicode, nsABCOMCardStruct * c
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsAbIPCCard::JoinHomeAddresses(PRBool isUnicode, nsABCOMCardStruct * card)
|
||||
void nsAbIPCCard::JoinAddress(PRBool isUnicode, LPTSTR *ptrAddress, nsString &address1, nsString &address2)
|
||||
{
|
||||
// If the two address lines in a moz card are not empty
|
||||
// then join the lines into a single line separated by
|
||||
// '\x0A'. This is the format expected by Palm.
|
||||
card->homeAddress = NULL;
|
||||
PRUint32 strLength= m_HomeAddress.Length() + m_HomeAddress2.Length();
|
||||
*ptrAddress = NULL;
|
||||
PRUint32 strLength= address1.Length() + address2.Length();
|
||||
if(!strLength)
|
||||
return;
|
||||
|
||||
|
@ -892,37 +917,37 @@ void nsAbIPCCard::JoinHomeAddresses(PRBool isUnicode, nsABCOMCardStruct * card)
|
|||
if(isUnicode)
|
||||
{
|
||||
PRUnichar * uniStr = (PRUnichar *) CoTaskMemAlloc(sizeof(PRUnichar) * (strLength));
|
||||
if(m_HomeAddress.Length())
|
||||
if(address1.Length())
|
||||
{
|
||||
wcsncpy(uniStr, m_HomeAddress.get(), strLength-1);
|
||||
wcsncpy(uniStr, address1.get(), strLength-1);
|
||||
uniStr[strLength-1] = '\0';
|
||||
if(m_HomeAddress2.Length())
|
||||
if(address2.Length())
|
||||
{
|
||||
wcsncat(uniStr, (const wchar_t *)"\x0A", strLength-1);
|
||||
wcsncat(uniStr, m_HomeAddress2.get(), strLength-1);
|
||||
wcsncat(uniStr, address2.get(), strLength-1);
|
||||
uniStr[strLength-1] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wcsncpy(uniStr, m_HomeAddress2.get(), strLength-1);
|
||||
wcsncpy(uniStr, address2.get(), strLength-1);
|
||||
uniStr[strLength-1] = '\0';
|
||||
}
|
||||
|
||||
card->homeAddress = uniStr;
|
||||
*ptrAddress = uniStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
char * str = (char *) CoTaskMemAlloc(strLength);
|
||||
nsCAutoString cStr;
|
||||
if(m_HomeAddress.Length())
|
||||
if(address1.Length())
|
||||
{
|
||||
cStr = NS_LossyConvertUCS2toASCII(m_HomeAddress);
|
||||
cStr = NS_LossyConvertUCS2toASCII(address1);
|
||||
strncpy(str, cStr.get(), strLength-1);
|
||||
str[strLength-1] = '\0';
|
||||
if(m_HomeAddress2.Length())
|
||||
if(address2.Length())
|
||||
{
|
||||
cStr = NS_LossyConvertUCS2toASCII(m_HomeAddress2);
|
||||
cStr = NS_LossyConvertUCS2toASCII(address2);
|
||||
strncat(str, "\x0A", strLength-1);
|
||||
strncat(str, cStr.get(), strLength-1);
|
||||
str[strLength-1] = '\0';
|
||||
|
@ -930,12 +955,17 @@ void nsAbIPCCard::JoinHomeAddresses(PRBool isUnicode, nsABCOMCardStruct * card)
|
|||
}
|
||||
else
|
||||
{
|
||||
cStr = NS_LossyConvertUCS2toASCII(m_HomeAddress2);
|
||||
cStr = NS_LossyConvertUCS2toASCII(address2);
|
||||
strncpy(str, cStr.get(), strLength-1);
|
||||
str[strLength-1] = '\0';
|
||||
}
|
||||
card->homeAddress = (LPTSTR) str;
|
||||
*ptrAddress = (LPTSTR) str;
|
||||
}
|
||||
}
|
||||
void nsAbIPCCard::JoinHomeAndWorkAddresses(PRBool isUnicode, nsABCOMCardStruct * card)
|
||||
{
|
||||
JoinAddress(isUnicode, &card->homeAddress, m_HomeAddress, m_HomeAddress2);
|
||||
JoinAddress(isUnicode, &card->workAddress, m_WorkAddress, m_WorkAddress2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -94,8 +94,10 @@ private:
|
|||
|
||||
void CopyValue(PRBool isUnicode, nsString & attribValue, LPTSTR * result);
|
||||
PRBool CompareValue(PRBool isUnicode, LPTSTR cardValue, nsString & attribValue);
|
||||
void SplitHomeAddresses(nsABCOMCardStruct * card, PRBool isUnicode);
|
||||
void JoinHomeAddresses(PRBool isUnicode, nsABCOMCardStruct * card);
|
||||
void SplitHomeAndWorkAddresses(nsABCOMCardStruct * card, PRBool isUnicode);
|
||||
void SplitAddresses(PRBool isUnicode, LPTSTR homeAddress, LPTSTR workAddress);
|
||||
void JoinHomeAndWorkAddresses(PRBool isUnicode, nsABCOMCardStruct * card);
|
||||
void JoinAddress(PRBool isUnicode, LPTSTR *ptrAddress, nsString &address1, nsString &address2);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -178,7 +178,7 @@ nsresult nsAbPalmHotSync::GetABInterface()
|
|||
nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
|
||||
nsXPIDLCString fileName, uri;
|
||||
nsXPIDLCString fileName, uri, prefName;
|
||||
nsAutoString description;
|
||||
PRUint32 dirType, palmSyncTimeStamp;
|
||||
PRInt32 palmCategoryIndex;
|
||||
|
@ -213,6 +213,7 @@ nsresult nsAbPalmHotSync::GetABInterface()
|
|||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetCategoryId(&palmCategoryIndex);
|
||||
if(NS_FAILED(rv)) return E_FAIL;
|
||||
rv = properties->GetPrefName(getter_Copies(prefName));
|
||||
|
||||
// Skip/Ignore 4.X addrbooks (ie, with ".na2" extension).
|
||||
if (((fileName.Length() > kABFileName_PreviousSuffixLen) &&
|
||||
|
@ -232,7 +233,7 @@ nsresult nsAbPalmHotSync::GetABInterface()
|
|||
// check for matching AB+Category, and special case personal address book
|
||||
// to match "Personal" category.
|
||||
if(description == mAbName ||
|
||||
(uri.Equals(PERSONAL_ADDRBOOK_URL, nsCaseInsensitiveCStringComparator())
|
||||
(prefName.Equals("ldap_2.servers.pab", nsCaseInsensitiveCStringComparator())
|
||||
&& mAbName.Equals(NS_LITERAL_STRING("Personal"), nsCaseInsensitiveStringComparator())))
|
||||
break;
|
||||
directory = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче