Fix bug #3574: Template addressing
[claws.git] / src / addrbook.h
blob863a8b0a2389297cc43e8f54737b51735fcc5bd2
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001 Match Grun
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 external address book files.
24 #ifndef __ADDRBOOK_H__
25 #define __ADDRBOOK_H__
27 #include <stdio.h>
28 #include <glib.h>
29 #include <setjmp.h>
31 #include "addritem.h"
32 #include "addrcache.h"
33 #include "adbookbase.h"
35 /* Address book file */
36 typedef struct _AddressBookFile AddressBookFile;
38 struct _AddressBookFile {
39 AddressBookType type;
40 AddressCache *addressCache;
41 gint retVal;
42 gchar *path;
43 gchar *fileName;
44 gint maxValue;
45 GList *tempList;
46 GHashTable *tempHash;
47 jmp_buf jumper;
50 /* Function prototypes */
52 AddressBookFile *addrbook_create_book ( void );
54 void addrbook_free_book ( AddressBookFile *book );
55 void addrbook_dump_book ( AddressBookFile *book, FILE *stream );
56 void addrbook_set_name ( AddressBookFile *book, const gchar *value );
57 void addrbook_set_path ( AddressBookFile *book, const gchar *value );
58 void addrbook_set_file ( AddressBookFile *book, const gchar *value );
59 gboolean addrbook_get_modified ( AddressBookFile *book );
60 gboolean addrbook_get_accessed ( AddressBookFile *book );
61 void addrbook_set_accessed ( AddressBookFile *book, const gboolean value );
62 gboolean addrbook_get_read_flag ( AddressBookFile *book );
63 gint addrbook_get_status ( AddressBookFile *book );
64 ItemFolder *addrbook_get_root_folder ( AddressBookFile *book );
65 GList *addrbook_get_list_folder ( AddressBookFile *book );
66 GList *addrbook_get_list_person ( AddressBookFile *book );
67 gchar *addrbook_get_name ( AddressBookFile *book );
68 gboolean addrbook_get_dirty ( AddressBookFile *book );
69 void addrbook_set_dirty ( AddressBookFile *book, const gboolean value );
71 ItemPerson *addrbook_remove_person ( AddressBookFile *book, ItemPerson *person );
72 ItemGroup *addrbook_remove_group ( AddressBookFile *book, ItemGroup *group );
73 ItemEMail *addrbook_person_remove_email ( AddressBookFile *book, ItemPerson *person,
74 ItemEMail *email );
76 gint addrbook_read_data ( AddressBookFile *book );
77 gint addrbook_save_data ( AddressBookFile *book );
79 void addrbook_update_address_list ( AddressBookFile *book, ItemPerson *person,
80 GList *listEMail );
81 ItemPerson *addrbook_add_address_list ( AddressBookFile *book, ItemFolder *folder,
82 GList *listEMail );
83 GList *addrbook_get_available_email_list( AddressBookFile *book, ItemGroup *group );
84 void addrbook_update_group_list ( AddressBookFile *book, ItemGroup *group,
85 GList *listEMail );
86 ItemGroup *addrbook_add_group_list ( AddressBookFile *book, ItemFolder *folder,
87 GList *listEMail );
88 ItemFolder *addrbook_add_new_folder ( AddressBookFile *book, ItemFolder *parent );
90 void addrbook_update_attrib_list ( AddressBookFile *book, ItemPerson *person,
91 GList *listAttrib );
92 void addrbook_add_attrib_list ( AddressBookFile *book, ItemPerson *person,
93 GList *listAttrib );
95 GList *addrbook_get_bookfile_list ( AddressBookFile *book );
96 gchar *addrbook_gen_new_file_name ( gint fileNum );
97 gint addrbook_test_read_file ( AddressBookFile *book, gchar *fileName );
99 GList *addrbook_get_all_persons ( AddressBookFile *book );
100 GList *addrbook_get_all_groups ( AddressBookFile *book );
102 ItemPerson *addrbook_add_contact ( AddressBookFile *book, ItemFolder *folder,
103 const gchar *name, const gchar *address,
104 const gchar *remarks );
106 gchar *addrbook_guess_next_file ( AddressBookFile *book );
107 void addrbook_delete_book_file ( AddressBookFile *book );
109 #endif /* __ADDRBOOK_H__ */