root / src / addrcache.h @ 1
History | View | Annotate | Download (5.5 kB)
| 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 for address cache. |
| 22 | */ |
| 23 | |
| 24 | #ifndef __ADDRCACHE_H__
|
| 25 | #define __ADDRCACHE_H__
|
| 26 | |
| 27 | #include <time.h> |
| 28 | #include <stdio.h> |
| 29 | #include <glib.h> |
| 30 | #include "addritem.h" |
| 31 | |
| 32 | /* Address cache */
|
| 33 | typedef struct _AddressCache AddressCache; |
| 34 | |
| 35 | struct _AddressCache {
|
| 36 | gint nextID; |
| 37 | gboolean dataRead; |
| 38 | gboolean modified; |
| 39 | time_t modifyTime; |
| 40 | GHashTable *itemHash; |
| 41 | GList *tempList; |
| 42 | ItemFolder *rootFolder; |
| 43 | }; |
| 44 | |
| 45 | /* Function prototypes */
|
| 46 | AddressCache *addrcache_create(); |
| 47 | ItemFolder *addrcache_get_root_folder ( AddressCache *cache ); |
| 48 | GList *addrcache_get_list_folder ( AddressCache *cache ); |
| 49 | GList *addrcache_get_list_person ( AddressCache *cache ); |
| 50 | |
| 51 | void addrcache_refresh ( AddressCache *cache );
|
| 52 | /* void addrcache_empty ( AddressCache *cache ); */
|
| 53 | void addrcache_clear ( AddressCache *cache );
|
| 54 | void addrcache_free ( AddressCache *cache );
|
| 55 | gboolean addrcache_check_file ( AddressCache *cache, gchar *path ); |
| 56 | gboolean addrcache_mark_file ( AddressCache *cache, gchar *path ); |
| 57 | |
| 58 | void addrcache_print_item_list ( GList *list, FILE *stream );
|
| 59 | void addrcache_print ( AddressCache *cache, FILE *stream );
|
| 60 | void addrcache_dump_hash ( AddressCache *cache, FILE *stream );
|
| 61 | |
| 62 | void addrcache_id_person ( AddressCache *cache, ItemPerson *person );
|
| 63 | void addrcache_id_group ( AddressCache *cache, ItemGroup *group );
|
| 64 | void addrcache_id_folder ( AddressCache *cache, ItemFolder *folder );
|
| 65 | void addrcache_id_email ( AddressCache *cache, ItemEMail *email );
|
| 66 | void addrcache_id_attribute ( AddressCache *cache, UserAttribute *attrib );
|
| 67 | |
| 68 | gboolean addrcache_hash_add_person ( AddressCache *cache, ItemPerson *person ); |
| 69 | gboolean addrcache_hash_add_group ( AddressCache *cache, ItemGroup *group ); |
| 70 | gboolean addrcache_hash_add_folder ( AddressCache *cache, ItemFolder *folder ); |
| 71 | |
| 72 | gboolean addrcache_folder_add_person ( AddressCache *cache, ItemFolder *folder, ItemPerson *item ); |
| 73 | gboolean addrcache_folder_add_folder ( AddressCache *cache, ItemFolder *folder, ItemFolder *item ); |
| 74 | gboolean addrcache_folder_add_group ( AddressCache *cache, ItemFolder *folder, ItemGroup *item ); |
| 75 | |
| 76 | gboolean addrcache_add_person ( AddressCache *cache, ItemPerson *person ); |
| 77 | gboolean addrcache_add_group ( AddressCache *cache, ItemGroup *group ); |
| 78 | gboolean addrcache_person_add_email ( AddressCache *cache, ItemPerson *person, ItemEMail *email ); |
| 79 | gboolean addrcache_group_add_email ( AddressCache *cache, ItemGroup *group, ItemEMail *email ); |
| 80 | gboolean addrcache_add_folder ( AddressCache *cache, ItemFolder *folder ); |
| 81 | |
| 82 | AddrItemObject *addrcache_get_object ( AddressCache *cache, const gchar *uid );
|
| 83 | ItemPerson *addrcache_get_person ( AddressCache *cache, const gchar *uid );
|
| 84 | ItemGroup *addrcache_get_group ( AddressCache *cache, const gchar *uid );
|
| 85 | ItemEMail *addrcache_get_email ( AddressCache *cache, const gchar *uid, const gchar *eid ); |
| 86 | |
| 87 | UserAttribute *addrcache_person_remove_attrib_id ( AddressCache *cache, const gchar *uid,
|
| 88 | const gchar *aid );
|
| 89 | UserAttribute *addrcache_person_remove_attribute ( AddressCache *cache, ItemPerson *person, |
| 90 | UserAttribute *attrib ); |
| 91 | |
| 92 | ItemGroup *addrcache_remove_group_id ( AddressCache *cache, const gchar *uid );
|
| 93 | ItemGroup *addrcache_remove_group ( AddressCache *cache, ItemGroup *group ); |
| 94 | |
| 95 | ItemPerson *addrcache_remove_person_id ( AddressCache *cache, const gchar *uid );
|
| 96 | ItemPerson *addrcache_remove_person ( AddressCache *cache, ItemPerson *person ); |
| 97 | ItemEMail *addrcache_person_remove_email_id ( AddressCache *cache, const gchar *uid, const gchar *eid ); |
| 98 | ItemEMail *addrcache_person_remove_email ( AddressCache *cache, ItemPerson *person, ItemEMail *email ); |
| 99 | |
| 100 | GList *addrcache_folder_get_address_list ( AddressCache *cache, ItemFolder *folder ); |
| 101 | GList *addrcache_folder_get_person_list ( AddressCache *cache, ItemFolder *folder ); |
| 102 | GList *addrcache_folder_get_group_list ( AddressCache *cache, ItemFolder *folder ); |
| 103 | GList *addrcache_folder_get_folder_list ( AddressCache *cache, ItemFolder *folder ); |
| 104 | |
| 105 | GList *addrcache_get_address_list ( AddressCache *cache ); |
| 106 | GList *addrcache_get_person_list ( AddressCache *cache ); |
| 107 | GList *addrcache_get_group_list ( AddressCache *cache ); |
| 108 | GList *addrcache_get_folder_list ( AddressCache *cache ); |
| 109 | |
| 110 | GList *addrcache_get_group_for_person ( AddressCache *cache, ItemPerson *person ); |
| 111 | |
| 112 | ItemFolder *addrcache_find_root_folder ( ItemFolder *folder ); |
| 113 | GList *addrcache_get_all_persons ( AddressCache *cache ); |
| 114 | GList *addrcache_get_all_groups ( AddressCache *cache ); |
| 115 | |
| 116 | ItemFolder *addrcache_remove_folder ( AddressCache *cache, ItemFolder *folder ); |
| 117 | ItemFolder *addrcache_remove_folder_delete ( AddressCache *cache, ItemFolder *folder ); |
| 118 | |
| 119 | ItemPerson *addrcache_add_contact ( AddressCache *cache, ItemFolder *folder, |
| 120 | const gchar *name, const gchar *address, |
| 121 | const gchar *remarks );
|
| 122 | |
| 123 | #endif /* __ADDRCACHE_H__ */ |