source: branches/branch-1-0/include/helpers/vcard.h@ 428

Last change on this file since 428 was 139, checked in by umoeller, 24 years ago

Sources as of V0.9.16.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 13.6 KB
Line 
1
2/*
3 *@@sourcefile vcard.h:
4 * header file for vcard.c. See remarks there.
5 *
6 * Note: Version numbering in this file relates to XWorkplace version
7 * numbering.
8 *
9 *@@include #include <os2.h>
10 *@@include #include "helpers\vcard.h"
11 */
12
13/* Copyright (C) 2002 Ulrich M”ller.
14 * This file is part of the "XWorkplace helpers" source package.
15 * This is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published
17 * by the Free Software Foundation, in version 2 as it comes in the
18 * "COPYING" file of the XWorkplace main distribution.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 */
24
25#if __cplusplus
26extern "C" {
27#endif
28
29#ifndef VCARD_HEADER_INCLUDED
30 #define VCARD_HEADER_INCLUDED
31
32 /* ******************************************************************
33 *
34 * Strings
35 *
36 ********************************************************************/
37
38 // DECLARE_VCARD_STRING is a handy macro which saves us from
39 // keeping two string lists in both the .h and the .c file.
40 // If this include file is included from the .c file, the
41 // string is defined as a global variable. Otherwise
42 // it is only declared as "extern" so other files can
43 // see it.
44
45 #ifdef INCLUDE_VCARD_PRIVATE
46 #define DECLARE_VCARD_STRING(str, def) const char *str = def
47 #else
48 #define DECLARE_VCARD_STRING(str, def) extern const char *str;
49 #endif
50
51 // +//ISBN 1-887687-00-9::versit::PDI//vCard
52 DECLARE_VCARD_STRING(VCF_FORMAL_IDENTIFIER,
53 "+//ISBN 1-887687-00-9::versit::PDI//vCard");
54
55 // common parameters
56 DECLARE_VCARD_STRING(VCFPARAM_ENCODING, "ENCODING");
57 // either BASE64, QUOTED-PRINTABLE, 8BIT
58 DECLARE_VCARD_STRING(VCFPARAM_CHARSET, "CHARSET");
59 // ADR;CHARSET=ISO-8859-8:...
60 DECLARE_VCARD_STRING(VCFPARAM_LANGUAGE, "LANGUAGE");
61 // ADR;LANGUAGE=fr-CA:...
62 DECLARE_VCARD_STRING(VCFPARAM_VALUE, "VALUE");
63 // INLINE (default)
64 // CONTENT-ID or CID (in separate MIME entity)
65 // URL
66
67 // formatted name (what is displayed)
68 DECLARE_VCARD_STRING(VCFPROP_FN, "FN");
69
70 // name
71 DECLARE_VCARD_STRING(VCFPROP_N, "N");
72 #define VCF_VALUE_INDEX_N_FAMILY 0
73 #define VCF_VALUE_INDEX_N_GIVEN 1 // first name
74 #define VCF_VALUE_INDEX_N_ADDITIONAL 2 // additional (middle) names
75 #define VCF_VALUE_INDEX_N_PREFIX 3 // prefix (Dr.)
76 #define VCF_VALUE_INDEX_N_SUFFIX 4 // suffix
77
78 // PHOTO
79 DECLARE_VCARD_STRING(VCFPROP_PHOTO, "PHOTO");
80 // parameters:
81 DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
82 // one of GIF, CGM, WMF, BMP, MET, PMB, DIB,
83 // PICT, TIFF, PS, PDF, JPEG, MPEG, MPEG2,
84 // AVI, QTIME
85
86 // birthday
87 DECLARE_VCARD_STRING(VCFPROP_BDAY, "BDAY");
88
89 // delivery address
90 DECLARE_VCARD_STRING(VCFPROP_ADR, "ADR");
91 // parameters:
92 // DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
93 // one or several of:
94 DECLARE_VCARD_STRING(VCF_TYPE_ADR_DOM, "DOM"); // domestic
95 DECLARE_VCARD_STRING(VCF_TYPE_ADR_INTL, "INTL"); // international address
96 DECLARE_VCARD_STRING(VCF_TYPE_ADR_POSTAL, "POSTAL"); // postal delivery address
97 DECLARE_VCARD_STRING(VCF_TYPE_ADR_PARCEL, "PARCEL"); // parcel delivery address
98 DECLARE_VCARD_STRING(VCF_TYPE_ADR_HOME, "HOME"); // home delivery address
99 DECLARE_VCARD_STRING(VCF_TYPE_ADR_WORK, "WORK"); // work delivery address
100 // default is INTL, WORK, POSTAL, PARCEL
101
102 // ADR;DOM;HOME:P.O. Box 101;Suite 101;123 Main Street;Any Town;CA;91921-1234;
103 #define VCF_VALUE_INDEX_ADR_POSTOFFICE 0 // post office, e.g. "P.O. Box 101"
104 #define VCF_VALUE_INDEX_ADR_EXTENDED 1 // "Suite 101"
105 #define VCF_VALUE_INDEX_ADR_STREET 2
106 #define VCF_VALUE_INDEX_ADR_LOCALITY 3 // town
107 #define VCF_VALUE_INDEX_ADR_REGION 4 // CA
108 #define VCF_VALUE_INDEX_ADR_POSTALCODE 5 // zip code
109 #define VCF_VALUE_INDEX_ADR_COUNTRY 6 // country
110
111 // formatted delivery label
112 DECLARE_VCARD_STRING(VCFPROP_LABEL, "LABEL");
113 // parameters: TYPE as with ADR
114
115 // telephone
116 DECLARE_VCARD_STRING(VCFPROP_TEL, "TEL");
117 // parameters:
118 // DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
119 // one or several of:
120 DECLARE_VCARD_STRING(VCF_TYPE_TEL_PREF, "PREF"); // preferred no.
121 DECLARE_VCARD_STRING(VCF_TYPE_TEL_WORK, "WORK"); // work no.
122 DECLARE_VCARD_STRING(VCF_TYPE_TEL_HOME, "HOME"); // home no.
123 DECLARE_VCARD_STRING(VCF_TYPE_TEL_VOICE, "VOICE"); // voice no. (default)
124 DECLARE_VCARD_STRING(VCF_TYPE_TEL_FAX, "FAX"); // fax no.
125 DECLARE_VCARD_STRING(VCF_TYPE_TEL_MSG, "MSG"); // messaging service
126 DECLARE_VCARD_STRING(VCF_TYPE_TEL_CELL, "CELL"); // cell phone
127 DECLARE_VCARD_STRING(VCF_TYPE_TEL_PAGER, "PAGER"); // pager
128 DECLARE_VCARD_STRING(VCF_TYPE_TEL_BBS, "BBS"); // bulletin board service
129 DECLARE_VCARD_STRING(VCF_TYPE_TEL_MODEM, "MODEM"); // modem
130 DECLARE_VCARD_STRING(VCF_TYPE_TEL_CAR, "CAR"); // car phone
131 DECLARE_VCARD_STRING(VCF_TYPE_TEL_ISDN, "ISDN"); // isdn
132 DECLARE_VCARD_STRING(VCF_TYPE_TEL_VIDEO, "VIDEO"); // video phone
133 // default is VOICE only
134
135 // EMAIL
136 DECLARE_VCARD_STRING(VCFPROP_EMAIL, "EMAIL");
137 // parameters:
138 // DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
139 // one or several of:
140 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_AOL, "AOL");
141 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_APPLELINK, "AppleLink");
142 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_ATTMAIL, "ATTMail");
143 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_CIS, "CIS");
144 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_EWORLD, "eWorld");
145 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_INTERNET, "INTERNET");
146 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_IBMMAIL, "IBMMail");
147 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_MCIMAIL, "MCIMail");
148 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_POWERSHARE, "POWERSHARE");
149 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_PRODIGY, "PRODIGY");
150 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_TLX, "TLX");
151 DECLARE_VCARD_STRING(VCF_TYPE_EMAIL_X400, "X400");
152
153 // MAILER software
154 DECLARE_VCARD_STRING(VCFPROP_MAILER, "MAILER");
155
156 // timezone
157 DECLARE_VCARD_STRING(VCFPROP_TZ, "TZ");
158
159 // geographic position
160 DECLARE_VCARD_STRING(VCFPROP_GEO, "GEO");
161
162 // job title
163 DECLARE_VCARD_STRING(VCFPROP_TITLE, "TITLE");
164
165 // business role
166 DECLARE_VCARD_STRING(VCFPROP_ROLE, "ROLE");
167
168 // company logo
169 DECLARE_VCARD_STRING(VCFPROP_LOGO, "LOGO");
170 // parameters: TYPE as with PHOTO
171
172 // organization name
173 DECLARE_VCARD_STRING(VCFPROP_ORG, "ORG");
174 #define VCF_VALUE_INDEX_ORG_NAME 0 // organization name
175 #define VCF_VALUE_INDEX_ORG_UNIT 1 // organization unit (division)
176
177 // comment
178 DECLARE_VCARD_STRING(VCFPROP_NOTE, "NOTE");
179
180 // when vCard was last modified
181 DECLARE_VCARD_STRING(VCFPROP_REV, "REV");
182 // ISO 8601
183 // format: REV:19951031T222710
184 // or REV:1995-10-31T22:27:10Z
185
186 // sound data
187 DECLARE_VCARD_STRING(VCFPROP_SOUND, "SOUND");
188 // DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
189 // one of WAVE, PCM, AIFF
190
191
192 // where to find up-to-date information
193 DECLARE_VCARD_STRING(VCFPROP_URL, "URL");
194
195 // unique vCard identifier
196 DECLARE_VCARD_STRING(VCFPROP_UID, "UID");
197
198 // vCard version info (2.1)
199 DECLARE_VCARD_STRING(VCFPROP_VERSION, "VERSION");
200 // must be "2.1"
201
202 // public key
203 DECLARE_VCARD_STRING(VCFPROP_KEY, "KEY");
204 // DECLARE_VCARD_STRING(VCFPARAM_TYPE, "TYPE");
205 // one of:
206 // -- X509
207 // -- PGP
208
209 // X-*: anything starting with X- is an extension
210
211 /* ******************************************************************
212 *
213 * Declarations
214 *
215 ********************************************************************/
216
217 #ifdef INCLUDE_VCARD_ALL
218
219 /*
220 *@@ VCFPROPERTY:
221 *
222 */
223
224 typedef struct _VCFPROPERTY
225 {
226 XSTRING strProperty;
227
228 PLINKLIST pllSubList; // if != NULL, nested list of
229 // PROPERTY structs
230
231 ULONG cParameters;
232 PXSTRING pastrParameters; // array of cParameters XSTRINGs
233
234 ULONG cValues;
235 PXSTRING pastrValues; // array of cValues XSTRINGs
236
237 } VCFPROPERTY, *PVCFPROPERTY;
238
239 #endif
240
241 /*
242 *@@ VCDATE:
243 *
244 */
245
246 typedef struct _VCDATE
247 {
248 UCHAR ucDay,
249 ucMonth;
250 USHORT usYear;
251 } VCDATE, *PVCDATE;
252
253 /*
254 *@@ VCTIME:
255 *
256 */
257
258 typedef struct _VCTIME
259 {
260 UCHAR ucHour,
261 ucMinutes,
262 ucSeconds;
263 } VCTIME, *PVCTIME;
264
265 /*
266 *@@ VCADDRESS:
267 *
268 */
269
270 typedef struct _VCADDRESS
271 {
272 PCSZ apcszAddress[7];
273 /* #define VCF_VALUE_INDEX_ADR_POSTOFFICE 0 // post office, e.g. "P.O. Box 101"
274 #define VCF_VALUE_INDEX_ADR_EXTENDED 1 // "Suite 101"
275 #define VCF_VALUE_INDEX_ADR_STREET 2
276 #define VCF_VALUE_INDEX_ADR_LOCALITY 3 // town
277 #define VCF_VALUE_INDEX_ADR_REGION 4 // CA
278 #define VCF_VALUE_INDEX_ADR_POSTALCODE 5 // zip code
279 #define VCF_VALUE_INDEX_ADR_COUNTRY 6 // country
280 */
281
282 ULONG fl;
283 #define VCF_ADDRFL_DOM 0x0001 // domestic
284 #define VCF_ADDRFL_INTL 0x0002 // international address
285 #define VCF_ADDRFL_POSTAL 0x0004 // postal delivery address
286 #define VCF_ADDRFL_PARCEL 0x0008 // parcel delivery address
287 #define VCF_ADDRFL_HOME 0x0010 // home delivery address
288 #define VCF_ADDRFL_WORK 0x0020 // work delivery address
289 // default is INTL, WORK, POSTAL, PARCEL
290
291 } VCADDRESS, *PVCADDRESS;
292
293 /*
294 *@@ VCLABEL:
295 *
296 */
297
298 typedef struct _VCLABEL
299 {
300 PCSZ pcszLabel;
301 ULONG fl; // VCF_ADDRFL_* flags
302 } VCLABEL, *PVCLABEL;
303
304 /*
305 *@@ VCPHONE:
306 *
307 */
308
309 typedef struct _VCPHONE
310 {
311 PCSZ pcszNumber;
312 ULONG fl;
313 #define VCF_PHONEFL_PREF 0x0001 // preferred no.
314 #define VCF_PHONEFL_WORK 0x0002 // work no.
315 #define VCF_PHONEFL_HOME 0x0004 // home no.
316 #define VCF_PHONEFL_VOICE 0x0008 // voice no. (default)
317 #define VCF_PHONEFL_FAX 0x0010 // fax no.
318 #define VCF_PHONEFL_MSG 0x0020 // messaging service
319 #define VCF_PHONEFL_CELL 0x0040 // cell phone
320 #define VCF_PHONEFL_PAGER 0x0080 // pager
321 #define VCF_PHONEFL_BBS 0x0100 // bulletin board service
322 #define VCF_PHONEFL_MODEM 0x0200 // modem
323 #define VCF_PHONEFL_CAR 0x0400 // car phone
324 #define VCF_PHONEFL_ISDN 0x0800 // isdn
325 #define VCF_PHONEFL_VIDEO 0x1000 // video phone
326 } VCPHONE, *PVCPHONE;
327
328 /*
329 *@@ VCARD:
330 *
331 *@@added V0.9.16 (2002-02-02) [umoeller]
332 */
333
334 typedef struct _VCARD
335 {
336 PCSZ pcszFormattedName;
337
338 PCSZ apcszName[5];
339 // VCF_VALUE_INDEX_N_FAMILY 0
340 // VCF_VALUE_INDEX_N_GIVEN 1 // first name
341 // VCF_VALUE_INDEX_N_ADDITIONAL 2 // additional (middle) names
342 // VCF_VALUE_INDEX_N_PREFIX 3 // prefix (Dr.)
343 // VCF_VALUE_INDEX_N_SUFFIX 4 // suffix
344
345 VCDATE vcdBirthday;
346
347 ULONG cDeliveryAddresses;
348 PVCADDRESS paDeliveryAddresses; // array of cAddresses VCADDRESS structs
349
350 ULONG cLabels;
351 PVCLABEL paLabels;
352
353 ULONG cPhones;
354 PVCPHONE paPhones;
355
356 PCSZ pcszEmail;
357
358 PCSZ pcszTimeZone;
359
360 PCSZ pcszJobTitle;
361
362 PCSZ pcszBusinessRole;
363
364 PCSZ pcszOrganizationName,
365 pcszOrganizationUnit;
366
367 PCSZ pcszURL;
368
369 VCDATE vcdRevision;
370 VCTIME vctRevision;
371
372 // private linked list of vCard properties
373 PLINKLIST pll;
374
375 } VCARD, *PVCARD;
376
377 APIRET vcfRead(PCSZ pcszFilename,
378 PVCARD *ppvCard);
379
380 APIRET vcfFree(PVCARD *pphvCard);
381
382#endif
383
384#if __cplusplus
385}
386#endif
387
Note: See TracBrowser for help on using the repository browser.