File: pi-contact.h

package info (click to toggle)
pilot-link 0.12.5-dfsg-2
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 6,868 kB
  • ctags: 5,811
  • sloc: ansic: 53,153; sh: 10,459; java: 2,584; perl: 2,247; python: 1,044; makefile: 991; yacc: 662; cpp: 551; xml: 39
file content (191 lines) | stat: -rw-r--r-- 5,303 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*******************************************************************************
 *
 * $Id: pi-contact.h,v 1.12 2009/02/23 11:59:16 nicholas Exp $
 *
 * pi-contact.h:  Translate Palm contact data formats
 * Derived from a module of J-Pilot http://jpilot.org (jp-pi-contact.h 1.5)
 *
 * Rewrite Copyright 2006, 2007 Judd Montgomery
 * Rewrite Copyright 2004, 2005 Joseph Carter
 * Copyright 2003, 2004 Judd Montgomery
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/

/*
 * Hints for uses of this library <= 1.11:
 *
 * appinfo->internal has changed from a pi_buffer_t to char array of fixed length.
 *
 * appinfo->labels has changed from a pi_buffer_t to an array of char
 * arrays of fixed length, and is no longer 'opaque'.
 *
 * contact->reminder has changed from -1 for 'not set', to 0 for 'not
 * set' and the reminder/advance duration is now in contact->advance.
 *
 * contact->picture has changed from a pi_buffer_t to a ContactPicture
 *
 * There is no longer a contact->pictype (if the picture exists, it's a JPEG.)
 *
 */

#ifndef _PILOT_CONTACT_H_
#define _PILOT_CONTACT_H_

#include <pi-args.h>
#include <pi-appinfo.h>
#include <pi-buffer.h>
#include <time.h>

#define MAX_CONTACT_VERSION 11

#define NUM_CONTACT_ENTRIES 39

#define NUM_CONTACT_V10_LABELS 49
#define NUM_CONTACT_V11_LABELS 53

/* Blob types, or blob creator IDs, can range from BD00 - Bd09 for Contacts */
#define BLOB_TYPE_PICTURE_ID "Bd00"
#define MAX_CONTACT_BLOBS 10

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
	contacts_v10,
	contacts_v11
} contactsType;

/* Entry fields */
enum { 
   contLastname, 
   contFirstname, 
   contCompany, 
   contTitle,
   contPhone1, 
   contPhone2,
   contPhone3,
   contPhone4,
   contPhone5,
   contPhone6,
   contPhone7,
   contIM1,
   contIM2,
   contWebsite,
   contCustom1,
   contCustom2,
   contCustom3,
   contCustom4,
   contCustom5,
   contCustom6,
   contCustom7,
   contCustom8,
   contCustom9,
   contAddress1,
   contCity1,
   contState1,
   contZip1,
   contCountry1,
   contAddress2,
   contCity2,
   contState2,
   contZip2,
   contCountry2,
   contAddress3,
   contCity3,
   contState3,
   contZip3,
   contCountry3,
   contNote
};

/* Non-entry fields */
enum { 
   contBirthday = contNote + 1,
   contPicture
};

struct ContactBlob {
   /* type ranges from "Bd00" - "Bd09" */
   char type[4];
   int length;
   unsigned char *data;
};

struct ContactPicture {
   /* The picture pointer is only for convienience and
    * will point to the 3rd byte of the last picture blob.
    * The data will not need to be freed.  The blob structure will. */
   unsigned int dirty;
   /* data points to blob data in jpeg format */
   unsigned int length;
   unsigned char *data;
};

struct Contact {
   int phoneLabel[7];
   int addressLabel[3];
   int IMLabel[2];
   int showPhone;
   int birthdayFlag;
   int reminder;
   int advance;
   int advanceUnits;    
   struct tm birthday;
   char *entry[39];
   struct ContactBlob *blob[MAX_CONTACT_BLOBS];
   struct ContactPicture *picture;
};

struct ContactAppInfo {
   contactsType type;
   int num_labels;
   struct CategoryAppInfo category;
   char internal[26];         /* Palm has not documented what this is */
   char labels[53][16];       /* Hairy to explain, obvious to look at */
   /*int labelRenamed[53];*/  /* list of booleans showing which labels were modified   */
   int country;
   int sortByCompany;
   int numCustoms;            /* Included for source compatibility with pi-contact.h <= 1.11 */
   char customLabels[9][16];  /* Duplication of some labels, to greatly reduce hair */
   char phoneLabels[8][16];   /* Duplication of some labels, to greatly reduce hair */
   char addrLabels[3][16];    /* Duplication of some labels, to greatly reduce hair */
   char IMLabels[5][16];      /* Duplication of some labels, to greatly reduce hair */
};

extern void free_Contact
    PI_ARGS((struct Contact *));
extern int unpack_Contact
    PI_ARGS((struct Contact *, pi_buffer_t *, contactsType));
extern int pack_Contact
    PI_ARGS((struct Contact *, pi_buffer_t *, contactsType));
extern int unpack_ContactAppInfo
    PI_ARGS((struct ContactAppInfo *, pi_buffer_t *));
extern int pack_ContactAppInfo
    PI_ARGS((struct ContactAppInfo *, pi_buffer_t *));

extern void free_ContactAppInfo
    PI_ARGS((struct ContactAppInfo *));

extern int Contact_add_blob
    PI_ARGS((struct Contact *, struct ContactBlob *));
extern int Contact_add_picture
    PI_ARGS((struct Contact *, struct ContactPicture *));

#ifdef __cplusplus
}

#endif            /* __cplusplus */
#endif            /* _PILOT_CONTACT_H_ */