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 Lesser 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 Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, 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"
40 #define EVC_ICSCALENDAR "ICSCALENDAR" /* XXX should this be X-EVOLUTION-ICSCALENDAR? */
42 #define EVC_LABEL "LABEL"
43 #define EVC_LOGO "LOGO"
44 #define EVC_MAILER "MAILER"
45 #define EVC_NICKNAME "NICKNAME"
47 #define EVC_NOTE "NOTE"
49 #define EVC_PHOTO "PHOTO"
50 #define EVC_PRODID "PRODID"
51 #define EVC_QUOTEDPRINTABLE "QUOTED-PRINTABLE"
53 #define EVC_ROLE "ROLE"
55 #define EVC_TITLE "TITLE"
56 #define EVC_TYPE "TYPE"
59 #define EVC_VALUE "VALUE"
60 #define EVC_VERSION "VERSION"
62 #define EVC_X_AIM "X-AIM"
63 #define EVC_X_ANNIVERSARY "X-EVOLUTION-ANNIVERSARY"
64 #define EVC_X_ASSISTANT "X-EVOLUTION-ASSISTANT"
65 #define EVC_X_BIRTHDAY "X-EVOLUTION-BIRTHDAY"
66 #define EVC_X_BLOG_URL "X-EVOLUTION-BLOG-URL"
67 #define EVC_X_CALLBACK "X-EVOLUTION-CALLBACK"
68 #define EVC_X_COMPANY "X-EVOLUTION-COMPANY"
69 #define EVC_X_DEST_CONTACT_UID "X-EVOLUTION-DEST-CONTACT-UID"
70 #define EVC_X_DEST_EMAIL "X-EVOLUTION-DEST-EMAIL"
71 #define EVC_X_DEST_EMAIL_NUM "X-EVOLUTION-DEST-EMAIL-NUM"
72 #define EVC_X_DEST_HTML_MAIL "X-EVOLUTION-DEST-HTML-MAIL"
73 #define EVC_X_DEST_NAME "X-EVOLUTION-DEST-NAME"
74 #define EVC_X_DEST_SOURCE_UID "X-EVOLUTION-DEST-SOURCE-UID"
75 #define EVC_X_FILE_AS "X-EVOLUTION-FILE-AS"
76 #define EVC_X_ICQ "X-ICQ"
77 #define EVC_X_JABBER "X-JABBER"
78 #define EVC_X_LIST_SHOW_ADDRESSES "X-EVOLUTION-LIST-SHOW_ADDRESSES"
79 #define EVC_X_LIST "X-EVOLUTION-LIST"
80 #define EVC_X_MANAGER "X-EVOLUTION-MANAGER"
81 #define EVC_X_MSN "X-MSN"
82 #define EVC_X_RADIO "X-EVOLUTION-RADIO"
83 #define EVC_X_SPOUSE "X-EVOLUTION-SPOUSE"
84 #define EVC_X_TELEX "X-EVOLUTION-TELEX"
85 #define EVC_X_TTYTDD "X-EVOLUTION-TTYTDD"
86 #define EVC_X_VIDEO_URL "X-EVOLUTION-VIDEO-URL"
87 #define EVC_X_WANTS_HTML "X-MOZILLA-HTML"
88 #define EVC_X_YAHOO "X-YAHOO"
89 #define EVC_X_GADUGADU "X-GADUGADU"
90 #define EVC_X_GROUPWISE "X-GROUPWISE"
91 #define EVC_X_BOOK_URI "X-EVOLUTION-BOOK-URI"
98 #define E_TYPE_VCARD (e_vcard_get_type ())
99 #define E_VCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_VCARD, EVCard))
100 #define E_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_VCARD, EVCardClass))
101 #define E_IS_VCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_VCARD))
102 #define E_IS_VCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_VCARD))
103 #define E_VCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_VCARD, EVCardClass))
105 typedef struct _EVCard EVCard;
106 typedef struct _EVCardClass EVCardClass;
107 typedef struct _EVCardPrivate EVCardPrivate;
108 typedef struct _EVCardAttribute EVCardAttribute;
109 typedef struct _EVCardAttributeParam EVCardAttributeParam;
117 struct _EVCardClass {
118 GObjectClass parent_class;
120 /* Padding for future expansion */
121 void (*_ebook_reserved0) (void);
122 void (*_ebook_reserved1) (void);
123 void (*_ebook_reserved2) (void);
124 void (*_ebook_reserved3) (void);
125 void (*_ebook_reserved4) (void);
128 GType e_vcard_get_type (void);
130 void e_vcard_construct (EVCard *evc, const char *str);
131 EVCard* e_vcard_new (void);
132 EVCard* e_vcard_new_from_string (const char *str);
134 char* e_vcard_to_string (EVCard *evc, EVCardFormat format);
136 /* mostly for debugging */
137 void e_vcard_dump_structure (EVCard *evc);
141 EVCardAttribute *e_vcard_attribute_new (const char *attr_group, const char *attr_name);
142 void e_vcard_attribute_free (EVCardAttribute *attr);
143 EVCardAttribute *e_vcard_attribute_copy (EVCardAttribute *attr);
144 void e_vcard_remove_attributes (EVCard *evc, const char *attr_group, const char *attr_name);
145 void e_vcard_remove_attribute (EVCard *evc, EVCardAttribute *attr);
146 void e_vcard_add_attribute (EVCard *evc, EVCardAttribute *attr);
147 void e_vcard_add_attribute_with_value (EVCard *evcard, EVCardAttribute *attr, const char *value);
148 void e_vcard_add_attribute_with_values (EVCard *evcard, EVCardAttribute *attr, ...);
149 void e_vcard_attribute_add_value (EVCardAttribute *attr, const char *value);
150 void e_vcard_attribute_add_value_decoded (EVCardAttribute *attr, const char *value, int len);
151 void e_vcard_attribute_add_values (EVCardAttribute *attr, ...);
152 void e_vcard_attribute_remove_value (EVCardAttribute *attr, const char *s);
153 void e_vcard_attribute_remove_values (EVCardAttribute *attr);
154 void e_vcard_attribute_remove_params (EVCardAttribute *attr);
155 void e_vcard_attribute_remove_param (EVCardAttribute *attr, const char *param_name);
156 void e_vcard_attribute_remove_param_value (EVCardAttribute *attr, const char *param_name, const char *s);
158 /* attribute parameters */
159 EVCardAttributeParam* e_vcard_attribute_param_new (const char *name);
160 void e_vcard_attribute_param_free (EVCardAttributeParam *param);
161 EVCardAttributeParam* e_vcard_attribute_param_copy (EVCardAttributeParam *param);
162 void e_vcard_attribute_add_param (EVCardAttribute *attr, EVCardAttributeParam *param);
163 void e_vcard_attribute_add_param_with_value (EVCardAttribute *attr,
164 EVCardAttributeParam *param, const char *value);
165 void e_vcard_attribute_add_param_with_values (EVCardAttribute *attr,
166 EVCardAttributeParam *param, ...);
168 void e_vcard_attribute_param_add_value (EVCardAttributeParam *param,
170 void e_vcard_attribute_param_add_values (EVCardAttributeParam *param,
172 void e_vcard_attribute_param_remove_values (EVCardAttributeParam *param);
174 /* EVCard* accessors. nothing returned from these functions should be
175 freed by the caller. */
176 EVCardAttribute *e_vcard_get_attribute (EVCard *evc, const char *name);
177 GList* e_vcard_get_attributes (EVCard *evcard);
178 const char* e_vcard_attribute_get_group (EVCardAttribute *attr);
179 const char* e_vcard_attribute_get_name (EVCardAttribute *attr);
180 GList* e_vcard_attribute_get_values (EVCardAttribute *attr); /* GList elements are of type char* */
181 GList* e_vcard_attribute_get_values_decoded (EVCardAttribute *attr); /* GList elements are of type GString* */
183 /* special accessors for single valued attributes */
184 gboolean e_vcard_attribute_is_single_valued (EVCardAttribute *attr);
185 char* e_vcard_attribute_get_value (EVCardAttribute *attr);
186 GString* e_vcard_attribute_get_value_decoded (EVCardAttribute *attr);
188 GList* e_vcard_attribute_get_params (EVCardAttribute *attr);
189 GList* e_vcard_attribute_get_param (EVCardAttribute *attr, const char *name);
190 const char* e_vcard_attribute_param_get_name (EVCardAttributeParam *param);
191 GList* e_vcard_attribute_param_get_values (EVCardAttributeParam *param);
193 /* special TYPE= parameter predicate (checks for TYPE=@typestr */
194 gboolean e_vcard_attribute_has_type (EVCardAttribute *attr, const char *typestr);
196 /* Utility functions. */
197 char* e_vcard_escape_string (const char *s);
198 char* e_vcard_unescape_string (const char *s);
202 #endif /* _EVCARD_H */