summaryrefslogtreecommitdiff
path: root/src/ldif.h
diff options
context:
space:
mode:
authorSimeon Simeonov2018-02-26 11:23:00 +0100
committerSimeon Simeonov2018-02-26 11:23:00 +0100
commit0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch)
treeaf916a30553c78ce9d4f2d8658656a175c5b6921 /src/ldif.h
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'src/ldif.h')
-rw-r--r--src/ldif.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/src/ldif.h b/src/ldif.h
new file mode 100644
index 0000000..05cd722
--- /dev/null
+++ b/src/ldif.h
@@ -0,0 +1,121 @@
1/*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001 Match Grun
4 *
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.
9 *
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.
14 *
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.
18 */
19
20/*
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.
25 */
26
27#ifndef __LDIF_H__
28#define __LDIF_H__
29
30#include <stdio.h>
31#include <glib.h>
32
33#include "addrcache.h"
34
35#define LDIFBUFSIZE 2048
36
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 "mozillanickname"
42#define LDIF_TAG_XNICKNAME "xmozillanickname"
43#define LDIF_TAG_NICKNAME2 "nickname"
44#define LDIF_TAG_EMAIL "mail"
45
46#define LDIF_SEP_TAG ':'
47#define LDIF_LANG_TAG ';'
48
49/*
50// Typical LDIF entry (similar to that generated by Netscape):
51//
52// dn: uid=axel, dc=axel, dc=com
53// cn: Axel Rose
54// sn: Rose
55// givenname: Arnold
56// xmozillanickname: Axel
57// mail: axel@axelrose.com
58// mail: axelrose@aol.com
59// mail: axel@netscape.net
60// mail: axel@hotmail.com
61// uid: axelrose
62// o: The Company
63// locality: Denver
64// st: CO
65// streetaddress: 777 Lexington Avenue
66// postalcode: 80298
67// countryname: USA
68// telephonenumber: 303-555-1234
69// homephone: 303-555-2345
70// cellphone: 303-555-3456
71// homeurl: http://www.axelrose.com
72// objectclass: top
73// objectclass: person
74//
75// Note that first entry is always dn. An empty line defines end of
76// record. Note that attribute names are case insensitive. There may
77// also be several occurrences of an attribute, for example, as
78// illustrated for "mail" and "objectclass" attributes. LDIF files
79// can also use binary data using base-64 encoding.
80//
81*/
82
83/* LDIF file object */
84typedef struct _LdifFile LdifFile;
85struct _LdifFile {
86 FILE *file;
87 gchar *path;
88 gchar *bufptr;
89 gchar buffer[ LDIFBUFSIZE ];
90 gint retVal;
91 GHashTable *hashFields;
92 GList *tempList;
93 gboolean dirtyFlag;
94 gboolean accessFlag;
95 void (*cbProgress)( void *, void *, void * );
96 gint importCount;
97};
98
99/* Field list structure */
100typedef struct _Ldif_FieldRec_ Ldif_FieldRec;
101struct _Ldif_FieldRec_ {
102 gchar *tagName;
103 gchar *userName;
104 gboolean reserved;
105 gboolean selected;
106};
107
108/* Function prototypes */
109LdifFile *ldif_create ( void );
110void ldif_set_file ( LdifFile* ldifFile, const gchar *value );
111void ldif_set_accessed ( LdifFile* ldifFile, const gboolean value );
112void ldif_set_callback ( LdifFile *ldifFile, void *func );
113void ldif_free ( LdifFile *ldifFile );
114void ldif_print_fieldrec ( Ldif_FieldRec *rec, FILE *stream );
115void ldif_print_file ( LdifFile *ldifFile, FILE *stream );
116gint ldif_import_data ( LdifFile *ldifFile, AddressCache *cache );
117gint ldif_read_tags ( LdifFile *ldifFile );
118GList *ldif_get_fieldlist ( LdifFile *ldifFile );
119
120#endif /* __LDIF_H__ */
121