Sync Spanish manual
[claws.git] / src / ldif.h
blobb5707a3b155ea79ba88f473c513ad8a6e818276c
1 /*
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.
27 #ifndef __LDIF_H__
28 #define __LDIF_H__
30 #include <stdio.h>
31 #include <glib.h>
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"
46 /* Object classes */
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
54 * cn: Axel Rose
55 * sn: Rose
56 * givenname: Arnold
57 * xmozillanickname: Axel
58 * mail: axel@axelrose.com
59 * mail: axelrose@aol.com
60 * mail: axel@netscape.net
61 * mail: axel@hotmail.com
62 * uid: axelrose
63 * o: The Company
64 * locality: Denver
65 * st: CO
66 * streetaddress: 777 Lexington Avenue
67 * postalcode: 80298
68 * countryname: USA
69 * telephonenumber: 303-555-1234
70 * homephone: 303-555-2345
71 * cellphone: 303-555-3456
72 * homeurl: http://www.axelrose.com
73 * objectclass: top
74 * objectclass: person
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;
86 struct _LdifFile {
87 FILE *file;
88 gchar *path;
89 gchar *bufptr;
90 gint retVal;
91 GHashTable *hashFields;
92 GList *tempList;
93 gboolean dirtyFlag;
94 gboolean accessFlag;
95 void (*cbProgress)( void *, void *, void * );
96 gint importCount;
99 /* LDIF field record structure */
100 typedef struct _Ldif_FieldRec_ Ldif_FieldRec;
101 struct _Ldif_FieldRec_ {
102 gchar *tagName;
103 gchar *userName;
104 gboolean reserved;
105 gboolean selected;
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__ */