my stab at fixing the non MT safety code in the LDAP lookup
[claws.git] / src / addrbook.h
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 external address book files.
22  */
23
24 #ifndef __ADDRBOOK_H__
25 #define __ADDRBOOK_H__
26
27 #include <stdio.h>
28 #include <glib.h>
29 #include <setjmp.h>
30
31 #include "addritem.h"
32 #include "addrcache.h"
33
34 /* Address book file */
35 typedef struct _AddressBookFile AddressBookFile;
36
37 struct _AddressBookFile {
38         gchar *name;
39         gchar *path;
40         gchar *fileName;
41         AddressCache *addressCache;
42         gint  retVal;
43         gint  maxValue;
44         GList *tempList;
45         GHashTable *tempHash;
46         gboolean readFlag;
47         gboolean dirtyFlag;
48         gboolean modifyFlag;
49         gboolean accessFlag;
50         jmp_buf jumper;
51 };
52
53 /* Function prototypes */
54
55 AddressBookFile *addrbook_create_book   ( void );
56 void addrbook_empty_book                ( AddressBookFile *book );
57 void addrbook_free_book                 ( AddressBookFile *book );
58 void addrbook_print_book                ( AddressBookFile *book, FILE *stream );
59 void addrbook_dump_hash                 ( AddressBookFile *book, FILE *stream );
60 void addrbook_dump_book                 ( AddressBookFile *book, FILE *stream );
61 void addrbook_set_name                  ( AddressBookFile *book, const gchar *value );
62 void addrbook_set_path                  ( AddressBookFile *book, const gchar *value );
63 void addrbook_set_file                  ( AddressBookFile *book, const gchar *value );
64 void addrbook_set_accessed              ( AddressBookFile *book, const gboolean value );
65 gboolean addrbook_get_modified          ( AddressBookFile *book );
66 gboolean addrbook_get_accessed          ( AddressBookFile *book );
67 gboolean addrbook_get_read_flag         ( AddressBookFile *book );
68 gint addrbook_get_status                ( AddressBookFile *book );
69 ItemFolder *addrbook_get_root_folder    ( AddressBookFile *book );
70 GList *addrbook_get_list_folder         ( AddressBookFile *book );
71 GList *addrbook_get_list_person         ( AddressBookFile *book );
72 gchar *addrbook_get_name                ( AddressBookFile *book );
73
74 ItemPerson *addrbook_remove_person      ( AddressBookFile *book, ItemPerson *person );
75 ItemGroup *addrbook_remove_group        ( AddressBookFile *book, ItemGroup *group );
76 ItemEMail *addrbook_person_remove_email ( AddressBookFile *book, ItemPerson *person,
77                                           ItemEMail *email );
78
79 gint addrbook_read_data                 ( AddressBookFile *book );
80 gint addrbook_save_data                 ( AddressBookFile *book );
81
82 ItemEMail *addrbook_move_email_before   ( AddressBookFile *book, ItemPerson *person,
83                                           ItemEMail *itemMove, ItemEMail *itemTarget );
84 ItemEMail *addrbook_move_email_after    ( AddressBookFile *book, ItemPerson *person,
85                                           ItemEMail *itemMove, ItemEMail *itemTarget );
86
87 void addrbook_update_address_list       ( AddressBookFile *book, ItemPerson *person,
88                                           GList *listEMail );
89 ItemPerson *addrbook_add_address_list   ( AddressBookFile *book, ItemFolder *folder,
90                                           GList *listEMail );
91 GList *addrbook_get_available_email_list( AddressBookFile *book, ItemGroup *group );
92 void addrbook_update_group_list         ( AddressBookFile *book, ItemGroup *group,
93                                           GList *listEMail );
94 ItemGroup *addrbook_add_group_list      ( AddressBookFile *book, ItemFolder *folder,
95                                           GList *listEMail );
96 ItemFolder *addrbook_add_new_folder     ( AddressBookFile *book, ItemFolder *parent );
97
98 void addrbook_update_attrib_list        ( AddressBookFile *book, ItemPerson *person, GList *listAttrib );
99 void addrbook_add_attrib_list           ( AddressBookFile *book, ItemPerson *person, GList *listAttrib );
100
101 ItemFolder *addrbook_remove_folder      ( AddressBookFile *book, ItemFolder *folder );
102 ItemFolder *addrbook_remove_folder_delete( AddressBookFile *book, ItemFolder *folder );
103
104 GList *addrbook_get_bookfile_list       ( AddressBookFile *book );
105 gchar *addrbook_gen_new_file_name       ( gint fileNum );
106 gint addrbook_test_read_file            ( AddressBookFile *book, gchar *fileName );
107
108 GList *addrbook_get_all_persons         ( AddressBookFile *book );
109
110 ItemPerson *addrbook_add_contact        ( AddressBookFile *book, ItemFolder *folder,
111                                           const gchar *name, const gchar *address,
112                                           const gchar *remarks );
113
114 #endif /* __ADDRBOOK_H__ */