summaryrefslogtreecommitdiff
path: root/src/addrindex.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/addrindex.h
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'src/addrindex.h')
-rw-r--r--src/addrindex.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/src/addrindex.h b/src/addrindex.h
new file mode 100644
index 0000000..092ba37
--- /dev/null
+++ b/src/addrindex.h
@@ -0,0 +1,133 @@
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 * General functions for accessing address index file.
22 */
23
24#ifndef __ADDRINDEX_H__
25#define __ADDRINDEX_H__
26
27#include <stdio.h>
28#include <glib.h>
29#include "addritem.h"
30
31#define ADDRESSBOOK_MAX_IFACE 4
32#define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
33#define ADDRESSBOOK_OLD_FILE "addressbook.xml"
34
35#define ADDR_DS_AUTOREG "@Auto-registered"
36
37typedef enum {
38 ADDR_IF_NONE,
39 ADDR_IF_BOOK,
40 ADDR_IF_VCARD,
41 ADDR_IF_JPILOT,
42 ADDR_IF_LDAP,
43 ADDR_IF_COMMON,
44 ADDR_IF_PERSONAL
45} AddressIfType;
46
47typedef struct _AddressIndex AddressIndex;
48struct _AddressIndex {
49 AddrItemObject obj;
50 gchar *filePath;
51 gchar *fileName;
52 gint retVal;
53 gboolean needsConversion;
54 gboolean wasConverted;
55 gboolean conversionError;
56 AddressIfType lastType;
57 gboolean dirtyFlag;
58 GList *interfaceList;
59};
60
61typedef struct _AddressInterface AddressInterface;
62struct _AddressInterface {
63 AddrItemObject obj;
64 AddressIfType type;
65 gchar *name;
66 gchar *listTag;
67 gchar *itemTag;
68 gboolean legacyFlag;
69 gboolean useInterface;
70 gboolean haveLibrary;
71 gboolean readOnly;
72 GList *listSource;
73 gboolean (*getModifyFlag)( void * );
74 gboolean (*getAccessFlag)( void * );
75 gboolean (*getReadFlag)( void * );
76 gint (*getStatusCode)( void * );
77 gint (*getReadData)( void * );
78 ItemFolder *(*getRootFolder)( void * );
79 GList *(*getListFolder)( void * );
80 GList *(*getListPerson)( void * );
81 GList *(*getAllPersons)( void * );
82 GList *(*getAllGroups)( void * );
83 gchar *(*getName)( void * );
84 void (*setAccessFlag)( void *, void * );
85};
86
87typedef struct _AddressDataSource AddressDataSource;
88struct _AddressDataSource {
89 AddrItemObject obj;
90 AddressIfType type;
91 AddressInterface *iface;
92 gpointer rawDataSource;
93};
94
95AddressIndex *addrindex_create_index ();
96void addrindex_set_file_path ( AddressIndex *addrIndex, const gchar *value );
97void addrindex_set_file_name ( AddressIndex *addrIndex, const gchar *value );
98void addrindex_set_dirty ( AddressIndex *addrIndex, const gboolean value );
99GList *addrindex_get_interface_list ( AddressIndex *addrIndex );
100void addrindex_free_index ( AddressIndex *addrIndex );
101void addrindex_print_index ( AddressIndex *addrIndex, FILE *stream );
102
103AddressInterface *addrindex_get_interface ( AddressIndex *addrIndex, AddressIfType ifType );
104AddressDataSource *addrindex_index_add_datasource ( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource );
105AddressDataSource *addrindex_index_remove_datasource ( AddressIndex *addrIndex, AddressDataSource *dataSource );
106void addrindex_free_datasource ( AddressIndex *addrIndex, AddressDataSource *ds );
107
108gint addrindex_read_data ( AddressIndex *addrIndex );
109gint addrindex_write_to ( AddressIndex *addrIndex, const gchar *newFile );
110gint addrindex_save_data ( AddressIndex *addrIndex );
111gint addrindex_create_new_books ( AddressIndex *addrIndex );
112gint addrindex_save_all_books ( AddressIndex *addrIndex );
113gint addrindex_create_extra_books ( AddressIndex *addrIndex );
114
115gboolean addrindex_ds_get_modify_flag ( AddressDataSource *ds );
116gboolean addrindex_ds_get_access_flag ( AddressDataSource *ds );
117gboolean addrindex_ds_get_read_flag ( AddressDataSource *ds );
118gint addrindex_ds_get_status_code ( AddressDataSource *ds );
119gint addrindex_ds_read_data ( AddressDataSource *ds );
120ItemFolder *addrindex_ds_get_root_folder( AddressDataSource *ds );
121GList *addrindex_ds_get_list_folder ( AddressDataSource *ds );
122GList *addrindex_ds_get_list_person ( AddressDataSource *ds );
123gchar *addrindex_ds_get_name ( AddressDataSource *ds );
124void addrindex_ds_set_access_flag ( AddressDataSource *ds, gboolean *value );
125gboolean addrindex_ds_get_readonly ( AddressDataSource *ds );
126GList *addrindex_ds_get_all_persons ( AddressDataSource *ds );
127GList *addrindex_ds_get_all_groups ( AddressDataSource *ds );
128
129#endif /* __ADDRINDEX_H__ */
130
131/*
132* End of Source.
133*/