Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions
CMozABConduitRecord Class Reference

#include <MozABConduitRecord.h>

Collaboration diagram for CMozABConduitRecord:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CMozABConduitRecord (void)
 CMozABConduitRecord (CPalmRecord &rec)
 CMozABConduitRecord (nsABCOMCardStruct &rec)
virtual ~CMozABConduitRecord ()
void Reset (void)
eRecCompare Compare (const CMozABConduitRecord &rec)
long ConvertFromGeneric (CPalmRecord &rec)
long ConvertToGeneric (CPalmRecord &rec)

Static Public Member Functions

static void CleanUpABCOMCardStruct (nsABCOMCardStruct *card)

Public Attributes

nsABCOMCardStruct m_nsCard
DWORD m_dwRecordID
DWORD m_dwStatus
DWORD m_dwPosition
CPString m_csName
CPString m_csFirst
CPString m_csDisplayName
CPString m_csTitle
CPString m_csCompany
DWORD m_dwPhone1LabelID
CPString m_csPhone1
DWORD m_dwPhone2LabelID
CPString m_csPhone2
DWORD m_dwPhone3LabelID
CPString m_csPhone3
DWORD m_dwPhone4LabelID
CPString m_csPhone4
DWORD m_dwPhone5LabelID
CPString m_csPhone5
CPString m_csAddress
CPString m_csCity
CPString m_csState
CPString m_csZipCode
CPString m_csCountry
CPString m_csNote
DWORD m_dwPrivate
DWORD m_dwCategoryID
CPString m_csCustom1
CPString m_csCustom2
CPString m_csCustom3
CPString m_csCustom4
DWORD m_dwDisplayPhone

Protected Member Functions

long CopyFromHHBuffer (TCHAR *pSrc, TCHAR *pDest, int len, int iBufSize)
long CopyFromHHBuffer (TCHAR *pSrc, TCHAR *pDest, int len)
int StripCRs (TCHAR *pDest, const TCHAR *pSrc, int len)
void AssignPhoneToMozData (DWORD labelID, LPTSTR buf)

Detailed Description

Definition at line 97 of file MozABConduitRecord.h.


Constructor & Destructor Documentation

Definition at line 58 of file MozABConduitRecord.cpp.

{
    Reset();
}

Here is the call graph for this function:

Definition at line 64 of file MozABConduitRecord.cpp.

Here is the call graph for this function:

Definition at line 70 of file MozABConduitRecord.cpp.

Here is the call graph for this function:

Definition at line 117 of file MozABConduitRecord.cpp.

{

}

Member Function Documentation

void CMozABConduitRecord::AssignPhoneToMozData ( DWORD  labelID,
LPTSTR  buf 
) [protected]

Definition at line 344 of file MozABConduitRecord.cpp.

Definition at line 562 of file MozABConduitRecord.cpp.

{
    if(!card)
        return;

    CoTaskMemFree(card->firstName);
    CoTaskMemFree(card->lastName);
    CoTaskMemFree(card->displayName);
    CoTaskMemFree(card->nickName);
    CoTaskMemFree(card->primaryEmail);
    CoTaskMemFree(card->secondEmail);
    CoTaskMemFree(card->workPhone);
    CoTaskMemFree(card->homePhone);
    CoTaskMemFree(card->faxNumber);
    CoTaskMemFree(card->pagerNumber);
    CoTaskMemFree(card->cellularNumber);
    CoTaskMemFree(card->homeAddress);
    CoTaskMemFree(card->homeAddress2);
    CoTaskMemFree(card->homeCity);
    CoTaskMemFree(card->homeState);
    CoTaskMemFree(card->homeZipCode);
    CoTaskMemFree(card->homeCountry);
    CoTaskMemFree(card->workAddress);
    CoTaskMemFree(card->workAddress2);
    CoTaskMemFree(card->workCity);
    CoTaskMemFree(card->workState);
    CoTaskMemFree(card->workZipCode);
    CoTaskMemFree(card->workCountry);
    CoTaskMemFree(card->jobTitle);
    CoTaskMemFree(card->department);
    CoTaskMemFree(card->company);
    CoTaskMemFree(card->webPage1);
    CoTaskMemFree(card->webPage2);
    CoTaskMemFree(card->birthYear);
    CoTaskMemFree(card->birthMonth);
    CoTaskMemFree(card->birthDay);
    CoTaskMemFree(card->custom1);
    CoTaskMemFree(card->custom2);
    CoTaskMemFree(card->custom3);
    CoTaskMemFree(card->custom4);
    CoTaskMemFree(card->notes);
    CoTaskMemFree(card->mailListURI);
}

Here is the caller graph for this function:

Definition at line 160 of file MozABConduitRecord.cpp.

{
    if ( (m_dwPhone1LabelID != rec.m_dwPhone1LabelID) ||
         (m_dwPhone2LabelID != rec.m_dwPhone2LabelID) ||
         (m_dwPhone3LabelID != rec.m_dwPhone3LabelID ) ||
         (m_dwPhone4LabelID != rec.m_dwPhone4LabelID ) ||
         (m_dwPhone5LabelID != rec.m_dwPhone5LabelID ) ||
         // 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 ) ||
         (m_csCompany !=  rec.m_csCompany ) ||
         (m_csPhone1 !=  rec.m_csPhone1 ) ||
         (m_csPhone2 !=  rec.m_csPhone2 ) ||
         (m_csPhone3 !=  rec.m_csPhone3 ) ||
         (m_csPhone4 !=  rec.m_csPhone4 ) ||
         (m_csCustom1 !=  rec.m_csCustom1 ) ||
         (m_csCustom2 !=  rec.m_csCustom2 ) ||
         (m_csCustom3 !=  rec.m_csCustom3 ) ||
         (m_csCustom4 !=  rec.m_csCustom4 ) ||
         (m_csPhone5 !=  rec.m_csPhone5 ) ||
         (m_csAddress !=  rec.m_csAddress ) ||
         (m_csCity !=  rec.m_csCity ) ||
         (m_csState !=  rec.m_csState ) ||
         (m_csZipCode !=  rec.m_csZipCode ) ||
         (m_csCountry !=  rec.m_csCountry ) ||
         (m_csNote !=  rec.m_csNote ))
         return eData;
    if (m_dwPrivate != rec.m_dwPrivate ) 
        return ePrivateFlag;
    if (m_dwCategoryID != rec.m_dwCategoryID ) 
        return eCategory;

    return eEqual;
}

Definition at line 213 of file MozABConduitRecord.cpp.

{
    long                retval = 0;
    BYTE                *pBuff;
    AddrDBRecordFlags   flags;
    AddrOptionsType     options;
    int iLen;

    Reset();

    if (rec.GetRawDataSize() == (sizeof(DWORD) + sizeof(DWORD) + sizeof(unsigned char))){
        // then this is a deleted record because it has no data
        return GEN_ERR_EMPTY_RECORD;
    }

    // palm specific data
    m_dwRecordID = rec.GetID();
    m_dwCategoryID = rec.GetCategory();
    m_dwPrivate    = rec.IsPrivate();
    m_dwStatus = rec.GetStatus();

    m_nsCard.dwRecordId = m_dwRecordID;
    m_nsCard.dwCategoryId = m_dwCategoryID;
    m_nsCard.dwStatus = m_dwStatus;

    // clear all values in the Address Record
    m_dwPhone1LabelID = PHONE_LABEL_WORK;
    m_dwPhone2LabelID = PHONE_LABEL_HOME;
    m_dwPhone3LabelID = PHONE_LABEL_FAX;
    m_dwPhone4LabelID = PHONE_LABEL_MOBILE;
    m_dwPhone5LabelID = PHONE_LABEL_EMAIL;
    m_dwDisplayPhone = m_nsCard.preferredPhoneNum;

    DWORD dwRawSize = rec.GetRawDataSize();
    if (!dwRawSize) {
        // invalid record
        return 0;
    }

    // get the data for moz card
    pBuff = rec.GetRawData();

    // AddrOptionsType
    *(DWORD *)&options = CPalmRecord::SwapDWordToIntel(*((DWORD*)pBuff));
    m_dwDisplayPhone  = (long)options.displayPhone + 1;
    m_dwPhone1LabelID = (DWORD)options.phone1;
    m_dwPhone2LabelID = (DWORD)options.phone2;
    m_dwPhone3LabelID = (DWORD)options.phone3;
    m_dwPhone4LabelID = (DWORD)options.phone4;
    m_dwPhone5LabelID = (DWORD)options.phone5;

    pBuff += sizeof(DWORD);

    // The flag bits are used to indicate which fields exist
    *(DWORD *)&flags = CPalmRecord::SwapDWordToIntel(*((DWORD*)pBuff));
    pBuff += sizeof(DWORD) + sizeof(unsigned char);

    // Name
    if (flags.name) COPY_FROM_GENERIC(m_csName, m_nsCard.lastName)
    // FirstName
    if (flags.firstName) COPY_FROM_GENERIC(m_csFirst, m_nsCard.firstName)
    // DisplayName
    m_csDisplayName = m_nsCard.firstName;
    m_csDisplayName += " ";
    m_csDisplayName += m_nsCard.lastName;
    m_nsCard.displayName = m_csDisplayName.GetBuffer(0);
    // Company
    if (flags.company) COPY_FROM_GENERIC(m_csCompany, m_nsCard.company)
    // Phones
    if (flags.phone1) COPY_PHONE_FROM_GENERIC(m_csPhone1, m_dwPhone1LabelID)
    if (flags.phone2) COPY_PHONE_FROM_GENERIC(m_csPhone2, m_dwPhone2LabelID)
    if (flags.phone3) COPY_PHONE_FROM_GENERIC(m_csPhone3, m_dwPhone3LabelID)
    if (flags.phone4) COPY_PHONE_FROM_GENERIC(m_csPhone4, m_dwPhone4LabelID)
    if (flags.phone5) COPY_PHONE_FROM_GENERIC(m_csPhone5, m_dwPhone5LabelID)
    // Address
    if (flags.address) 
    {
      if (MozABPCManager::gUseHomeAddress)
        COPY_FROM_GENERIC(m_csAddress, m_nsCard.homeAddress)
      else
         COPY_FROM_GENERIC(m_csAddress, m_nsCard.workAddress)

//      CONDUIT_LOG4(gFD, "\nConvertFromGeneric gUseHomeAddress = %s card home address = %s card work address = %s result = %s\n", 
//        (MozABPCManager::gUseHomeAddress) ? "true" : "false", (char *) m_nsCard.homeAddress, (char *) m_nsCard.workAddress, (char *) m_csAddress);
    }
    // City
    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) 
    {
      if (MozABPCManager::gUseHomeAddress)
        COPY_FROM_GENERIC(m_csState, m_nsCard.homeState)
      else
        COPY_FROM_GENERIC(m_csState, m_nsCard.workState)
    }
    // ZipCode
    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)
    {
      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
    if (flags.custom1) COPY_FROM_GENERIC(m_csCustom1, m_nsCard.custom1)
    if (flags.custom2) COPY_FROM_GENERIC(m_csCustom2, m_nsCard.custom2)
    if (flags.custom3) COPY_FROM_GENERIC(m_csCustom3, m_nsCard.custom3)
    if (flags.custom4) COPY_FROM_GENERIC(m_csCustom4, m_nsCard.custom4)
    // Note
    if (flags.note) COPY_FROM_GENERIC(m_csNote, m_nsCard.notes)

    return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 384 of file MozABConduitRecord.cpp.

{
    long                retval = 0;
    char                *pBuff, *pFlags, *pCompany, *pFirst;
    AddrDBRecordFlags   flags;
    AddrOptionsType     options;
    int                 destLen;
    BYTE                szRawData[MAX_RECORD_SIZE];
    DWORD               dwRecSize = 0;
    int                 iLen=0;


    rec.SetID(m_dwRecordID);

    rec.SetCategory(m_dwCategoryID);

    rec.SetPrivate(m_dwPrivate);

       rec.SetAttribs(m_dwStatus);

    pBuff = (char*)szRawData;

    // AddrOptionsType
    *(DWORD *)&options = 0;
    options.displayPhone = m_dwDisplayPhone - 1;
    options.phone1 = LOWORD(m_dwPhone1LabelID);
    options.phone2 = LOWORD(m_dwPhone2LabelID);
    options.phone3 = LOWORD(m_dwPhone3LabelID);
    options.phone4 = LOWORD(m_dwPhone4LabelID);
    options.phone5 = LOWORD(m_dwPhone5LabelID);
    *((DWORD *)pBuff) = CPalmRecord::SwapDWordToMotor(*(DWORD *)&options);

    pBuff += sizeof(DWORD);
    dwRecSize += sizeof(DWORD);

    // The flag bits are used to indicate which fields exist
    pFlags = pBuff;
    *(DWORD *)&flags = 0;
    pBuff += sizeof(DWORD);
    dwRecSize += sizeof(DWORD);
    
    // Company Field Offset - Initialize to zero
    pCompany = pBuff;
    *((unsigned char *)pCompany) = 0;
    pBuff += sizeof(unsigned char);
    dwRecSize += sizeof(unsigned char);
    
    // First Field
    pFirst = pBuff;

    // Name
    COPY_TO_GENERIC(m_csName, flags.name)
    // FirstName
    COPY_TO_GENERIC(m_csFirst, flags.firstName)
    // Company
    COPY_TO_GENERIC(m_csCompany, flags.company)
    // Phone1
    COPY_TO_GENERIC(m_csPhone1, flags.phone1)
    // Phone2
    COPY_TO_GENERIC(m_csPhone2, flags.phone2)
    // Phone3
    COPY_TO_GENERIC(m_csPhone3, flags.phone3)
    // Phone4
    COPY_TO_GENERIC(m_csPhone4, flags.phone4)
    // Phone5
    COPY_TO_GENERIC(m_csPhone5, flags.phone5)
    // Address
    COPY_TO_GENERIC(m_csAddress, flags.address)
    // City
    COPY_TO_GENERIC(m_csCity, flags.city)
    // State
    COPY_TO_GENERIC(m_csState, flags.state)
    // ZipCode
    COPY_TO_GENERIC(m_csZipCode, flags.zipCode)
    // Country
    COPY_TO_GENERIC(m_csCountry, flags.country)
    // Title
    COPY_TO_GENERIC(m_csTitle, flags.title)
    // Custom1
    COPY_TO_GENERIC(m_csCustom1, flags.custom1)
    // Custom2
    COPY_TO_GENERIC(m_csCustom2, flags.custom2)
    // Custom3
    COPY_TO_GENERIC(m_csCustom3, flags.custom3)
    // Custom4
    COPY_TO_GENERIC(m_csCustom4, flags.custom4)
    // Note
    COPY_TO_GENERIC(m_csNote, flags.note)

    // Store the AddrDBRecordFlags
    *((DWORD *)pFlags) = CPalmRecord::SwapDWordToMotor(*(DWORD *)&flags);

    
    if (dwRecSize == (sizeof(DWORD) + sizeof(DWORD) + sizeof(unsigned char))){
        // then this is a deleted record because it has no data
        rec.SetDeleted();
    }

    retval = rec.SetRawData(dwRecSize, szRawData);

    return(retval);
}

Here is the caller graph for this function:

long CMozABConduitRecord::CopyFromHHBuffer ( TCHAR pSrc,
TCHAR pDest,
int  len,
int  iBufSize 
) [protected]
long CMozABConduitRecord::CopyFromHHBuffer ( TCHAR pSrc,
TCHAR pDest,
int  len 
) [protected]

Definition at line 489 of file MozABConduitRecord.cpp.

{
    long retval = GEN_ERR_INVALID_POINTER;
    int off=0;

    TCHAR* pCurr;

    if (pDest) {

        // Only add Cr's if newlines are present..
        pCurr = _tcspbrk(pSrc, STR_NEWLINE);
        if(pCurr) 
        {
            while (off < len && *pSrc)
            {
                if (*pSrc == CH_NEWLINE)
                {
                    *pDest = CH_CRETURN;
                    pDest++;
                }
                *pDest = *pSrc;

                pDest++ ; pSrc++;
                off++;
            }
            *pDest = 0;
        }
        else 
        {
            strncpy(pDest, pSrc, len);
            pDest[len] = 0;
        }
        retval = 0;
    }
    return(retval);
}

Definition at line 123 of file MozABConduitRecord.cpp.

{
    memset(&m_nsCard, 0, sizeof(nsABCOMCardStruct));

    m_dwRecordID = 0;
    m_dwStatus = 0;
    m_dwPosition = 0;
    m_dwPhone1LabelID = 0;
    m_dwPhone2LabelID = 0;
    m_dwPhone3LabelID = 0;
    m_dwPhone4LabelID = 0;
    m_dwPhone5LabelID = 0;
    m_dwPrivate = 0;
    m_dwCategoryID = 0;
    m_dwDisplayPhone = 1; // work 
    m_csName.Empty();
    m_csFirst.Empty();
    m_csTitle.Empty();
    m_csCompany.Empty();
    m_csPhone1.Empty();
    m_csPhone2.Empty();
    m_csPhone3.Empty();
    m_csPhone4.Empty();
    m_csCustom1.Empty();
    m_csCustom2.Empty();
    m_csCustom3.Empty();
    m_csCustom4.Empty();
    m_csPhone5.Empty();
    m_csAddress.Empty();
    m_csCity.Empty();
    m_csState.Empty();
    m_csZipCode.Empty();
    m_csCountry.Empty();
    m_csNote.Empty();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMozABConduitRecord::StripCRs ( TCHAR pDest,
const TCHAR pSrc,
int  len 
) [protected]

Definition at line 527 of file MozABConduitRecord.cpp.

{
    int  retval = 0;
    int  off    = 0;
    TCHAR* pCurr; 
    TCHAR* pStart = pDest;

    // See if any cr's are present in the first place.
    pCurr = _tcspbrk(pSrc, STR_CRETURN);
    if (pCurr)
    {
        while (off < len && *pSrc)
        {
            if (*pSrc == CH_CRETURN)
                pSrc++;

            *pDest = *pSrc;

            off++;
            pDest++ ; pSrc++;
        }
        *pDest = 0;

        retval = strlen(pStart) + 1;
    }
    else
    {
        strncpy(pDest, pSrc, len);
        *(pDest + len) = '\0';
        retval = len + 1;
    }    

    return(retval);
}

Member Data Documentation

Definition at line 128 of file MozABConduitRecord.h.

Definition at line 129 of file MozABConduitRecord.h.

Definition at line 117 of file MozABConduitRecord.h.

Definition at line 132 of file MozABConduitRecord.h.

Definition at line 136 of file MozABConduitRecord.h.

Definition at line 137 of file MozABConduitRecord.h.

Definition at line 138 of file MozABConduitRecord.h.

Definition at line 139 of file MozABConduitRecord.h.

Definition at line 115 of file MozABConduitRecord.h.

Definition at line 114 of file MozABConduitRecord.h.

Definition at line 113 of file MozABConduitRecord.h.

Definition at line 133 of file MozABConduitRecord.h.

Definition at line 119 of file MozABConduitRecord.h.

Definition at line 121 of file MozABConduitRecord.h.

Definition at line 123 of file MozABConduitRecord.h.

Definition at line 125 of file MozABConduitRecord.h.

Definition at line 127 of file MozABConduitRecord.h.

Definition at line 130 of file MozABConduitRecord.h.

Definition at line 116 of file MozABConduitRecord.h.

Definition at line 131 of file MozABConduitRecord.h.

Definition at line 135 of file MozABConduitRecord.h.

Definition at line 140 of file MozABConduitRecord.h.

Definition at line 118 of file MozABConduitRecord.h.

Definition at line 120 of file MozABConduitRecord.h.

Definition at line 122 of file MozABConduitRecord.h.

Definition at line 124 of file MozABConduitRecord.h.

Definition at line 126 of file MozABConduitRecord.h.

Definition at line 112 of file MozABConduitRecord.h.

Definition at line 134 of file MozABConduitRecord.h.

Definition at line 110 of file MozABConduitRecord.h.

Definition at line 111 of file MozABConduitRecord.h.

Definition at line 107 of file MozABConduitRecord.h.


The documentation for this class was generated from the following files: