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 * General functions for accessing address index file.
24 #ifndef __ADDRINDEX_H__
25 #define __ADDRINDEX_H__
30 #include "addrcache.h"
31 #include "addrquery.h"
33 #define ADDRESSBOOK_MAX_IFACE 4
34 #define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
35 #define ADDRESSBOOK_OLD_FILE "addressbook.xml"
47 typedef struct _AddressIndex AddressIndex
;
48 struct _AddressIndex
{
53 gboolean needsConversion
;
54 gboolean wasConverted
;
55 gboolean conversionError
;
56 AddressIfType lastType
;
59 GHashTable
*hashCache
;
64 typedef struct _AddressInterface AddressInterface
;
65 struct _AddressInterface
{
72 gboolean useInterface
;
76 gboolean (*getModifyFlag
)( void * );
77 gboolean (*getAccessFlag
)( void * );
78 gboolean (*getReadFlag
)( void * );
79 gint (*getStatusCode
)( void * );
80 gint (*getReadData
)( void * );
81 ItemFolder
*(*getRootFolder
)( void * );
82 GList
*(*getListFolder
)( void * );
83 GList
*(*getListPerson
)( void * );
84 GList
*(*getAllPersons
)( void * );
85 GList
*(*getAllGroups
)( void * );
86 gchar
*(*getName
)( void * );
87 void (*setAccessFlag
)( void *, void * );
88 gboolean externalQuery
;
90 void (*startSearch
)( void * );
91 void (*stopSearch
)( void * );
95 /* W32 headers define INTERFACE to "struct". */
99 typedef struct _AddressDataSource AddressDataSource
;
100 struct _AddressDataSource
{
103 AddressInterface
*interface
;
104 gpointer rawDataSource
;
107 void addrindex_initialize ( void );
108 void addrindex_teardown ( void );
110 AddressIndex
*addrindex_create_index ( void );
111 void addrindex_set_file_path ( AddressIndex
*addrIndex
,
112 const gchar
*value
);
113 void addrindex_set_file_name ( AddressIndex
*addrIndex
,
114 const gchar
*value
);
116 GList
*addrindex_get_interface_list ( AddressIndex
*addrIndex
);
117 void addrindex_free_index ( AddressIndex
*addrIndex
);
118 void addrindex_print_index ( AddressIndex
*addrIndex
, FILE *stream
);
121 AddressDataSource
*addrindex_index_add_datasource ( AddressIndex
*addrIndex
,
122 AddressIfType ifType
,
123 gpointer dataSource
);
124 AddressDataSource
*addrindex_index_remove_datasource ( AddressIndex
*addrIndex
,
125 AddressDataSource
*dataSource
);
127 void addrindex_free_datasource ( AddressDataSource
*ds
);
128 gchar
*addrindex_get_cache_id ( AddressIndex
*addrIndex
,
129 AddressDataSource
*ds
);
130 AddressCache
*addrindex_get_cache ( AddressIndex
*addrIndex
,
131 const gchar
*cacheID
);
133 gint
addrindex_read_data ( AddressIndex
*addrIndex
);
134 gint
addrindex_save_data ( AddressIndex
*addrIndex
);
135 gint
addrindex_create_new_books ( AddressIndex
*addrIndex
);
136 gint
addrindex_save_all_books ( AddressIndex
*addrIndex
);
138 gboolean
addrindex_ds_get_modify_flag ( AddressDataSource
*ds
);
139 gboolean
addrindex_ds_get_access_flag ( AddressDataSource
*ds
);
140 gboolean
addrindex_ds_get_read_flag ( AddressDataSource
*ds
);
141 gint
addrindex_ds_get_status_code ( AddressDataSource
*ds
);
142 gint
addrindex_ds_read_data ( AddressDataSource
*ds
);
143 ItemFolder
*addrindex_ds_get_root_folder( AddressDataSource
*ds
);
144 gchar
*addrindex_ds_get_name ( AddressDataSource
*ds
);
145 void addrindex_ds_set_access_flag ( AddressDataSource
*ds
,
147 gboolean
addrindex_ds_get_readonly ( AddressDataSource
*ds
);
150 gint
addrindex_setup_search ( const gchar
*searchTerm
,
152 void *callBackEntry
);
154 gint
addrindex_setup_static_search ( AddressDataSource
*ds
,
155 const gchar
*searchTerm
,
158 void *callBackEntry
);
160 gboolean
addrindex_start_search ( const gint queryID
);
161 void addrindex_stop_search ( const gint queryID
);
162 gint
addrindex_setup_explicit_search ( AddressDataSource
*ds
,
163 const gchar
*searchTerm
,
166 void *callBackEntry
);
167 void addrindex_remove_results ( AddressDataSource
*ds
,
168 ItemFolder
*folder
);
170 gboolean
addrindex_load_completion(
172 ( const gchar
*, const gchar
*,
173 const gchar
*, const gchar
*, GList
* ),
176 gboolean
addrindex_load_person_attribute( const gchar
*attr
,
178 ( ItemPerson
*, const gchar
* ) );
180 gboolean
addrindex_load_person_ds( gint (*callBackFunc
)
181 ( ItemPerson
*, AddressDataSource
* ) );
182 gchar
*addrindex_get_picture_file(const gchar
*emailaddr
);
185 GSList
*addrindex_get_password_protected_ldap_servers();
188 #endif /* __ADDRINDEX_H__ */