2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2001-2012 Match Grun and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * Definitions necessary to access LDIF files (LDAP Data Interchange Format
22 * files). These files are used to load LDAP servers and to interchange data
23 * between servers. They are also used by several E-Mail client programs and
24 * other programs as a means of interchange address book data.
33 #include "addrcache.h"
35 #define LDIFBUFSIZE 2048
37 /* Common tag names - for address book import/export */
38 #define LDIF_TAG_DN "dn"
39 #define LDIF_TAG_COMMONNAME "cn"
40 #define LDIF_TAG_FIRSTNAME "givenName"
41 #define LDIF_TAG_LASTNAME "sn"
42 #define LDIF_TAG_NICKNAME "displayName"
43 #define LDIF_TAG_EMAIL "mail"
44 #define LDIF_TAG_OBJECTCLASS "objectClass"
47 #define LDIF_CLASS_PERSON "person"
48 #define LDIF_CLASS_INET_PERSON "inetOrgPerson"
51 * Typical LDIF entry (similar to that generated by Netscape):
53 * dn: uid=axel, dc=axel, dc=com
57 * xmozillanickname: Axel
58 * mail: axel@axelrose.com
59 * mail: axelrose@aol.com
60 * mail: axel@netscape.net
61 * mail: axel@hotmail.com
66 * streetaddress: 777 Lexington Avenue
69 * telephonenumber: 303-555-1234
70 * homephone: 303-555-2345
71 * cellphone: 303-555-3456
72 * homeurl: http://www.axelrose.com
76 * Note that first entry is always dn. An empty line defines end of
77 * record. Note that attribute names are case insensitive. There may
78 * also be several occurrences of an attribute, for example, as
79 * illustrated for "mail" and "objectclass" attributes. LDIF files
80 * can also use binary data using base-64 encoding.
84 /* LDIF file object */
85 typedef struct _LdifFile LdifFile
;
91 GHashTable
*hashFields
;
95 void (*cbProgress
)( void *, void *, void * );
99 /* LDIF field record structure */
100 typedef struct _Ldif_FieldRec_ Ldif_FieldRec
;
101 struct _Ldif_FieldRec_
{
108 /* Function prototypes */
109 LdifFile
*ldif_create ( void );
110 void ldif_set_file ( LdifFile
* ldifFile
, const gchar
*value
);
111 void ldif_set_accessed ( LdifFile
* ldifFile
, const gboolean value
);
112 void ldif_field_set_name ( Ldif_FieldRec
*rec
, const gchar
*value
);
113 void ldif_field_set_selected ( Ldif_FieldRec
*rec
, const gboolean value
);
114 void ldif_field_toggle ( Ldif_FieldRec
*rec
);
115 void ldif_free ( LdifFile
*ldifFile
);
116 void ldif_print_file ( LdifFile
*ldifFile
, FILE *stream
);
117 gint
ldif_import_data ( LdifFile
*ldifFile
, AddressCache
*cache
);
118 gint
ldif_read_tags ( LdifFile
*ldifFile
);
119 GList
*ldif_get_fieldlist ( LdifFile
*ldifFile
);
120 gboolean
ldif_write_value ( FILE *stream
, const gchar
*name
,
121 const gchar
*value
);
122 void ldif_write_eor ( FILE *stream
);
124 #endif /* __LDIF_H__ */