1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4
* Copyright (C) 2003 Ximian, Inc.
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of version 2 of the GNU General Public
8
* License as published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
20
* Author: Chris Toshok (toshok@ximian.com)
27
#include <glib-object.h>
32
#define EVC_BDAY "BDAY"
33
#define EVC_CALURI "CALURI"
34
#define EVC_CATEGORIES "CATEGORIES"
35
#define EVC_EMAIL "EMAIL"
36
#define EVC_ENCODING "ENCODING"
37
#define EVC_FBURL "FBURL"
39
#define EVC_ICSCALENDAR "ICSCALENDAR" /* XXX should this be X-EVOLUTION-ICSCALENDAR? */
41
#define EVC_LABEL "LABEL"
42
#define EVC_LOGO "LOGO"
43
#define EVC_MAILER "MAILER"
44
#define EVC_NICKNAME "NICKNAME"
46
#define EVC_NOTE "NOTE"
48
#define EVC_PHOTO "PHOTO"
49
#define EVC_PRODID "PRODID"
50
#define EVC_QUOTEDPRINTABLE "QUOTED-PRINTABLE"
52
#define EVC_ROLE "ROLE"
54
#define EVC_TITLE "TITLE"
55
#define EVC_TYPE "TYPE"
58
#define EVC_VALUE "VALUE"
59
#define EVC_VERSION "VERSION"
61
#define EVC_X_AIM "X-AIM"
62
#define EVC_X_ANNIVERSARY "X-EVOLUTION-ANNIVERSARY"
63
#define EVC_X_ASSISTANT "X-EVOLUTION-ASSISTANT"
64
#define EVC_X_BIRTHDAY "X-EVOLUTION-BIRTHDAY"
65
#define EVC_X_BLOG_URL "X-EVOLUTION-BLOG-URL"
66
#define EVC_X_CALLBACK "X-EVOLUTION-CALLBACK"
67
#define EVC_X_COMPANY "X-EVOLUTION-COMPANY"
68
#define EVC_X_DEST_CONTACT_UID "X-EVOLUTION-DEST-CONTACT-UID"
69
#define EVC_X_DEST_EMAIL "X-EVOLUTION-DEST-EMAIL"
70
#define EVC_X_DEST_EMAIL_NUM "X-EVOLUTION-DEST-EMAIL-NUM"
71
#define EVC_X_DEST_HTML_MAIL "X-EVOLUTION-DEST-HTML-MAIL"
72
#define EVC_X_DEST_NAME "X-EVOLUTION-DEST-NAME"
73
#define EVC_X_DEST_SOURCE_UID "X-EVOLUTION-DEST-SOURCE-UID"
74
#define EVC_X_FILE_AS "X-EVOLUTION-FILE-AS"
75
#define EVC_X_ICQ "X-ICQ"
76
#define EVC_X_JABBER "X-JABBER"
77
#define EVC_X_LIST_SHOW_ADDRESSES "X-EVOLUTION-LIST-SHOW_ADDRESSES"
78
#define EVC_X_LIST "X-EVOLUTION-LIST"
79
#define EVC_X_MANAGER "X-EVOLUTION-MANAGER"
80
#define EVC_X_MSN "X-MSN"
81
#define EVC_X_RADIO "X-EVOLUTION-RADIO"
82
#define EVC_X_SPOUSE "X-EVOLUTION-SPOUSE"
83
#define EVC_X_TELEX "X-EVOLUTION-TELEX"
84
#define EVC_X_TTYTDD "X-EVOLUTION-TTYTDD"
85
#define EVC_X_VIDEO_URL "X-EVOLUTION-VIDEO-URL"
86
#define EVC_X_WANTS_HTML "X-MOZILLA-HTML"
87
#define EVC_X_YAHOO "X-YAHOO"
88
#define EVC_X_GROUPWISE "X-GROUPWISE"
95
#define E_TYPE_VCARD (e_vcard_get_type ())
96
#define E_VCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_VCARD, EVCard))
97
#define E_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_VCARD, EVCardClass))
98
#define E_IS_VCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_VCARD))
99
#define E_IS_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_VCARD))
100
#define E_VCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_VCARD, EVCardClass))
102
typedef struct _EVCard EVCard;
103
typedef struct _EVCardClass EVCardClass;
104
typedef struct _EVCardPrivate EVCardPrivate;
105
typedef struct _EVCardAttribute EVCardAttribute;
106
typedef struct _EVCardAttributeParam EVCardAttributeParam;
114
struct _EVCardClass {
115
GObjectClass parent_class;
117
/* Padding for future expansion */
118
void (*_ebook_reserved0) (void);
119
void (*_ebook_reserved1) (void);
120
void (*_ebook_reserved2) (void);
121
void (*_ebook_reserved3) (void);
122
void (*_ebook_reserved4) (void);
125
GType e_vcard_get_type (void);
127
void e_vcard_construct (EVCard *evc, const char *str);
128
EVCard* e_vcard_new (void);
129
EVCard* e_vcard_new_from_string (const char *str);
131
char* e_vcard_to_string (EVCard *evc, EVCardFormat format);
133
/* mostly for debugging */
134
void e_vcard_dump_structure (EVCard *evc);
138
EVCardAttribute *e_vcard_attribute_new (const char *attr_group, const char *attr_name);
139
void e_vcard_attribute_free (EVCardAttribute *attr);
140
EVCardAttribute *e_vcard_attribute_copy (EVCardAttribute *attr);
141
void e_vcard_remove_attributes (EVCard *evcard, const char *attr_group, const char *attr_name);
142
void e_vcard_remove_attribute (EVCard *evcard, EVCardAttribute *attr);
143
void e_vcard_add_attribute (EVCard *evcard, EVCardAttribute *attr);
144
void e_vcard_add_attribute_with_value (EVCard *evcard, EVCardAttribute *attr, const char *value);
145
void e_vcard_add_attribute_with_values (EVCard *evcard, EVCardAttribute *attr, ...);
146
void e_vcard_attribute_add_value (EVCardAttribute *attr, const char *value);
147
void e_vcard_attribute_add_value_decoded (EVCardAttribute *attr, const char *value, int len);
148
void e_vcard_attribute_add_values (EVCardAttribute *attr, ...);
149
void e_vcard_attribute_remove_values (EVCardAttribute *attr);
150
void e_vcard_attribute_remove_params (EVCardAttribute *attr);
152
/* attribute parameters */
153
EVCardAttributeParam* e_vcard_attribute_param_new (const char *param_name);
154
void e_vcard_attribute_param_free (EVCardAttributeParam *param);
155
EVCardAttributeParam* e_vcard_attribute_param_copy (EVCardAttributeParam *param);
156
void e_vcard_attribute_add_param (EVCardAttribute *attr, EVCardAttributeParam *param);
157
void e_vcard_attribute_add_param_with_value (EVCardAttribute *attr,
158
EVCardAttributeParam *param, const char *value);
159
void e_vcard_attribute_add_param_with_values (EVCardAttribute *attr,
160
EVCardAttributeParam *param, ...);
162
void e_vcard_attribute_param_add_value (EVCardAttributeParam *param,
164
void e_vcard_attribute_param_add_values (EVCardAttributeParam *param,
166
void e_vcard_attribute_param_remove_values (EVCardAttributeParam *param);
168
/* EVCard* accessors. nothing returned from these functions should be
169
freed by the caller. */
170
GList* e_vcard_get_attributes (EVCard *evcard);
171
const char* e_vcard_attribute_get_group (EVCardAttribute *attr);
172
const char* e_vcard_attribute_get_name (EVCardAttribute *attr);
173
GList* e_vcard_attribute_get_values (EVCardAttribute *attr); /* GList elements are of type char* */
174
GList* e_vcard_attribute_get_values_decoded (EVCardAttribute *attr); /* GList elements are of type GString* */
176
/* special accessors for single valued attributes */
177
gboolean e_vcard_attribute_is_single_valued (EVCardAttribute *attr);
178
char* e_vcard_attribute_get_value (EVCardAttribute *attr);
179
GString* e_vcard_attribute_get_value_decoded (EVCardAttribute *attr);
181
GList* e_vcard_attribute_get_params (EVCardAttribute *attr);
182
const char* e_vcard_attribute_param_get_name (EVCardAttributeParam *param);
183
GList* e_vcard_attribute_param_get_values (EVCardAttributeParam *param);
185
/* special TYPE= parameter predicate (checks for TYPE=@typestr */
186
gboolean e_vcard_attribute_has_type (EVCardAttribute *attr, const char *typestr);
188
/* Utility functions. */
189
char* e_vcard_escape_string (const char *str);
190
char* e_vcard_unescape_string (const char *str);
194
#endif /* _EVCARD_H */