Fix bug #3574: Template addressing
[claws.git] / src / addrcache.h
blob33dc2e1eecb1252fd3dd12907348c717f31f4586
1 /*
2 * Sylpheed -- 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 * Definitions for address cache.
24 #ifndef __ADDRCACHE_H__
25 #define __ADDRCACHE_H__
27 #include <time.h>
28 #include <stdio.h>
29 #include <glib.h>
30 #include "addritem.h"
32 /* Address cache */
33 typedef struct _AddressCache AddressCache;
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 gchar *cacheID;
44 gboolean dirtyFlag;
45 gboolean accessFlag;
46 gchar *name;
49 /* Function prototypes */
50 AddressCache *addrcache_create ( void );
51 ItemFolder *addrcache_get_root_folder ( AddressCache *cache );
52 GList *addrcache_get_list_folder ( AddressCache *cache );
53 GList *addrcache_get_list_person ( AddressCache *cache );
54 gboolean addrcache_get_dirty ( AddressCache *cache );
55 void addrcache_set_dirty ( AddressCache *cache,
56 const gboolean value );
57 gchar *addrcache_get_name ( AddressCache *cache );
58 void addrcache_set_name ( AddressCache *cache,
59 const gchar *value );
61 void addrcache_refresh ( AddressCache *cache );
62 void addrcache_clear ( AddressCache *cache );
63 void addrcache_free ( AddressCache *cache );
64 gboolean addrcache_check_file ( AddressCache *cache, gchar *path );
65 gboolean addrcache_mark_file ( AddressCache *cache, gchar *path );
67 void addrcache_print ( AddressCache *cache, FILE *stream );
69 void addrcache_id_person ( AddressCache *cache, ItemPerson *person );
70 void addrcache_id_group ( AddressCache *cache, ItemGroup *group );
71 void addrcache_id_folder ( AddressCache *cache, ItemFolder *folder );
72 void addrcache_id_email ( AddressCache *cache, ItemEMail *email );
73 void addrcache_id_attribute ( AddressCache *cache, UserAttribute *attrib );
75 gboolean addrcache_hash_add_person ( AddressCache *cache, ItemPerson *person );
76 gboolean addrcache_hash_add_group ( AddressCache *cache, ItemGroup *group );
77 gboolean addrcache_hash_add_folder ( AddressCache *cache, ItemFolder *folder );
79 gboolean addrcache_folder_add_person ( AddressCache *cache,
80 ItemFolder *folder,
81 ItemPerson *item );
82 gboolean addrcache_folder_add_folder ( AddressCache *cache,
83 ItemFolder *folder,
84 ItemFolder *item );
85 gboolean addrcache_folder_add_group ( AddressCache *cache,
86 ItemFolder *folder,
87 ItemGroup *item );
89 gboolean addrcache_add_person ( AddressCache *cache,
90 ItemPerson *person );
91 gboolean addrcache_add_group ( AddressCache *cache,
92 ItemGroup *group );
93 gboolean addrcache_person_add_email ( AddressCache *cache,
94 ItemPerson *person,
95 ItemEMail *email );
96 gboolean addrcache_group_add_email ( AddressCache *cache,
97 ItemGroup *group,
98 ItemEMail *email );
99 gboolean addrcache_add_folder ( AddressCache *cache,
100 ItemFolder *folder );
102 void addrcache_folder_move_person ( AddressCache *cache,
103 ItemPerson *person,
104 ItemFolder *target );
105 void addrcache_folder_move_group ( AddressCache *cache,
106 ItemGroup *group,
107 ItemFolder *target );
108 void addrcache_folder_move_folder ( AddressCache *cache,
109 ItemFolder *folder,
110 ItemFolder *target );
112 AddrItemObject *addrcache_get_object ( AddressCache *cache, const gchar *uid );
113 ItemEMail *addrcache_get_email ( AddressCache *cache, const gchar *eid );
116 ItemGroup *addrcache_remove_group ( AddressCache *cache, ItemGroup *group );
117 ItemPerson *addrcache_remove_person ( AddressCache *cache, ItemPerson *person );
118 ItemEMail *addrcache_remove_email ( AddressCache *cache, ItemEMail *email );
120 ItemEMail *addrcache_person_remove_email( AddressCache *cache,
121 ItemPerson *person,
122 ItemEMail *email );
124 GList *addrcache_get_group_for_person ( AddressCache *cache, ItemPerson *person );
126 GList *addrcache_get_all_persons ( AddressCache *cache );
127 GList *addrcache_get_all_groups ( AddressCache *cache );
129 ItemFolder *addrcache_remove_folder ( AddressCache *cache,
130 ItemFolder *folder );
131 ItemFolder *addrcache_remove_folder_delete ( AddressCache *cache,
132 ItemFolder *folder );
134 ItemPerson *addrcache_add_contact ( AddressCache *cache,
135 ItemFolder *folder,
136 const gchar *name,
137 const gchar *address,
138 const gchar *remarks );
140 ItemFolder *addrcache_add_new_folder ( AddressCache *cache,
141 ItemFolder *parent );
143 #endif /* __ADDRCACHE_H__ */