addrbook.h (4255B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 2001-2022 Match Grun and the Claws Mail team 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 3 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, see <http://www.gnu.org/licenses/>. 17 */ 18 19 /* 20 * Definitions necessary to access external address book files. 21 */ 22 23 #ifndef __ADDRBOOK_H__ 24 #define __ADDRBOOK_H__ 25 26 #include <stdio.h> 27 #include <glib.h> 28 #include <setjmp.h> 29 30 #include "addritem.h" 31 #include "addrcache.h" 32 #include "adbookbase.h" 33 34 /* Address book file */ 35 typedef struct _AddressBookFile AddressBookFile; 36 37 struct _AddressBookFile { 38 AddressBookType type; 39 AddressCache *addressCache; 40 gint retVal; 41 gchar *path; 42 gchar *fileName; 43 gint maxValue; 44 GList *tempList; 45 GHashTable *tempHash; 46 jmp_buf jumper; 47 }; 48 49 /* Function prototypes */ 50 51 AddressBookFile *addrbook_create_book ( void ); 52 53 void addrbook_free_book ( AddressBookFile *book ); 54 #ifdef DEBUG_ADDRBOOK 55 void addrbook_dump_book ( AddressBookFile *book, FILE *stream ); 56 #endif 57 void addrbook_set_name ( AddressBookFile *book, const gchar *value ); 58 void addrbook_set_path ( AddressBookFile *book, const gchar *value ); 59 void addrbook_set_file ( AddressBookFile *book, const gchar *value ); 60 gboolean addrbook_get_modified ( AddressBookFile *book ); 61 gboolean addrbook_get_accessed ( AddressBookFile *book ); 62 void addrbook_set_accessed ( AddressBookFile *book, const gboolean value ); 63 gboolean addrbook_get_read_flag ( AddressBookFile *book ); 64 gint addrbook_get_status ( AddressBookFile *book ); 65 ItemFolder *addrbook_get_root_folder ( AddressBookFile *book ); 66 GList *addrbook_get_list_folder ( AddressBookFile *book ); 67 GList *addrbook_get_list_person ( AddressBookFile *book ); 68 gchar *addrbook_get_name ( AddressBookFile *book ); 69 gboolean addrbook_get_dirty ( AddressBookFile *book ); 70 void addrbook_set_dirty ( AddressBookFile *book, const gboolean value ); 71 72 ItemPerson *addrbook_remove_person ( AddressBookFile *book, ItemPerson *person ); 73 ItemGroup *addrbook_remove_group ( AddressBookFile *book, ItemGroup *group ); 74 ItemEMail *addrbook_person_remove_email ( AddressBookFile *book, ItemPerson *person, 75 ItemEMail *email ); 76 77 gint addrbook_read_data ( AddressBookFile *book ); 78 gint addrbook_save_data ( AddressBookFile *book ); 79 80 void addrbook_update_address_list ( AddressBookFile *book, ItemPerson *person, 81 GList *listEMail ); 82 ItemPerson *addrbook_add_address_list ( AddressBookFile *book, ItemFolder *folder, 83 GList *listEMail ); 84 GList *addrbook_get_available_email_list( AddressBookFile *book, ItemGroup *group ); 85 void addrbook_update_group_list ( AddressBookFile *book, ItemGroup *group, 86 GList *listEMail ); 87 ItemGroup *addrbook_add_group_list ( AddressBookFile *book, ItemFolder *folder, 88 GList *listEMail ); 89 ItemFolder *addrbook_add_new_folder ( AddressBookFile *book, ItemFolder *parent ); 90 91 void addrbook_update_attrib_list ( AddressBookFile *book, ItemPerson *person, 92 GList *listAttrib ); 93 void addrbook_add_attrib_list ( AddressBookFile *book, ItemPerson *person, 94 GList *listAttrib ); 95 96 GList *addrbook_get_bookfile_list ( AddressBookFile *book ); 97 gchar *addrbook_gen_new_file_name ( gint fileNum ); 98 gint addrbook_test_read_file ( AddressBookFile *book, gchar *fileName ); 99 100 GList *addrbook_get_all_persons ( AddressBookFile *book ); 101 GList *addrbook_get_all_groups ( AddressBookFile *book ); 102 103 ItemPerson *addrbook_add_contact ( AddressBookFile *book, ItemFolder *folder, 104 const gchar *name, const gchar *address, 105 const gchar *remarks ); 106 107 gchar *addrbook_guess_next_file ( AddressBookFile *book ); 108 void addrbook_delete_book_file ( AddressBookFile *book ); 109 110 #endif /* __ADDRBOOK_H__ */