1 line
40 KiB
C++
1 line
40 KiB
C++
|
/* Copyright (c) 2017, Computer History Museum
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to
the limitations in the disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. */
#include "osxabsync.h"
#define FILE_NUM 148
/* Copyright Qualcomm, Inc. 2003 */
#include "MachOWrapper.h"
#include "osxabsyncinc.h"
/////////////////////////////////////////////////////////////////////////
//
// osxabsync.c
//
// This file provides services to slurp in all the contacts from the
// Mac OS X address book into a Eudora nicknames file. One way synching
// is supported, with two way not too far away.
//
// An interesting mix of C and C++. C++ was used in the original
// OSXAddressBookSync EMSAPI pluging. Rather than rewriting all
// of that code, I've chosen to live in a muddled world.
//
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
// OS X Address Book Type Declarations.
//
/////////////////////////////////////////////////////////////////////////
/*
* ABSyncRecordField
*/
typedef struct _ABSyncRecordField
{
long m_EudoraABFieldName;
const char *m_pOSXABProperty;
const char *m_pOSXABKey;
const char *m_pOSXABLabel;
} ABSyncRecordField;
/*
* ABSyncRecord
*/
// ABSyncRecord class
class ABSyncRecord
{
private:
// are we a group?
Boolean fIsGroup;
// nickname to use for this record
Str255 fEudoraNickName;
// a table of field mapping data
const ABSyncRecordField *fFieldMappingTable;
// an array of the address book field values
CFStringRef fOSXABFieldValues[ABReservedTagsLimit];
// the nickname pulled from the AddressBook
CFStringRef fOSXABNickName;
// an array of the address book field multi values
ABMultiValueRef fOSXABFieldMultiValues[ABReservedTagsLimit];
// other email addresses
CFMutableStringRef fOtherEmailAddresses;
// initialize internals
void ABSyncRecord_Initialize(void);
// recursive group import
void ABSyncRecord_ImportGroupMembers(ABGroupRef abRecord);
public:
// constructor
ABSyncRecord();
// destructor
~ABSyncRecord();
// release internals
void ABSyncRecord_Reset(void);
// import a contact from the OS X Address Book
void ABSyncRecord_ImportContact(ABPersonRef abRecord);
// import a group from the OS X Address Book
void ABSyncRecord_ImportGroup(ABGroupRef abRecord);
// generate a Nickname from a record
unsigned char *ABSyncRecord_GenerateNickName(void);
// Generate a Eudora Address Book compatible alias line
Handle ABSyncRecord_GenerateAddressLine(void);
// Generate a
|