2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001 Match Grun
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 2 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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 /* Reserved tag names - for address book import */
38 #define LDIF_TAG_COMMONNAME "cn"
39 #define LDIF_TAG_FIRSTNAME "givenname"
40 #define LDIF_TAG_LASTNAME "sn"
41 #define LDIF_TAG_NICKNAME "xmozillanickname"
42 #define LDIF_TAG_EMAIL "mail"
44 #define LDIF_SEP_TAG ':'
45 #define LDIF_LANG_TAG ';'
48 * Typical LDIF entry (similar to that generated by Netscape):
50 * dn: uid=axel, dc=axel, dc=com
54 * xmozillanickname: Axel
55 * mail: axel@axelrose.com
56 * mail: axelrose@aol.com
57 * mail: axel@netscape.net
58 * mail: axel@hotmail.com
63 * streetaddress: 777 Lexington Avenue
66 * telephonenumber: 303-555-1234
67 * homephone: 303-555-2345
68 * cellphone: 303-555-3456
69 * homeurl: http://www.axelrose.com
73 * Note that first entry is always dn. An empty line defines end of
74 * record. Note that attribute names are case insensitive. There may
75 * also be several occurrences of an attribute, for example, as
76 * illustrated for "mail" and "objectclass" attributes. LDIF files
77 * can also use binary data using base-64 encoding.
81 /* LDIF file object */
82 typedef struct _LdifFile LdifFile
;
87 gchar buffer
[ LDIFBUFSIZE
];
89 GHashTable
*hashFields
;
93 void (*cbProgress
)( void *, void *, void * );
97 /* Field list structure */
98 typedef struct _Ldif_FieldRec_ Ldif_FieldRec
;
99 struct _Ldif_FieldRec_
{
106 /* Function prototypes */
107 LdifFile
*ldif_create ( void );
108 void ldif_set_file ( LdifFile
* ldifFile
, const gchar
*value
);
109 void ldif_set_accessed ( LdifFile
* ldifFile
, const gboolean value
);
110 void ldif_set_callback ( LdifFile
*ldifFile
, void *func
);
111 void ldif_free ( LdifFile
*ldifFile
);
112 void ldif_print_fieldrec ( Ldif_FieldRec
*rec
, FILE *stream
);
113 void ldif_print_file ( LdifFile
*ldifFile
, FILE *stream
);
114 gint
ldif_import_data ( LdifFile
*ldifFile
, AddressCache
*cache
);
115 gint
ldif_read_tags ( LdifFile
*ldifFile
);
116 GList
*ldif_get_fieldlist ( LdifFile
*ldifFile
);
118 #endif /* __LDIF_H__ */