Statistics
| Revision:

root / src / addrcache.h @ 3386

History | View | Annotate | Download (5.53 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
#include "utils.h"
32

    
33
/* Address cache */
34
typedef struct _AddressCache AddressCache;
35

    
36
struct _AddressCache {
37
        gint       nextID;
38
        gboolean   dataRead;
39
        gboolean   modified;
40
        stime_t    modifyTime;
41
        GHashTable *itemHash;
42
        GList      *tempList;
43
        ItemFolder *rootFolder;
44
};
45

    
46
/* Function prototypes */
47
AddressCache *addrcache_create();
48
ItemFolder *addrcache_get_root_folder        ( AddressCache *cache );
49
GList *addrcache_get_list_folder        ( AddressCache *cache );
50
GList *addrcache_get_list_person        ( AddressCache *cache );
51

    
52
void addrcache_refresh                        ( AddressCache *cache );
53
/* void addrcache_empty                        ( AddressCache *cache ); */
54
void addrcache_clear                        ( AddressCache *cache );
55
void addrcache_free                        ( AddressCache *cache );
56
gboolean addrcache_check_file                ( AddressCache *cache, gchar *path );
57
gboolean addrcache_mark_file                ( AddressCache *cache, gchar *path );
58

    
59
void addrcache_print_item_list                ( GList *list, FILE *stream );
60
void addrcache_print                        ( AddressCache *cache, FILE *stream );
61
void addrcache_dump_hash                ( AddressCache *cache, FILE *stream );
62

    
63
void addrcache_id_person                ( AddressCache *cache, ItemPerson *person );
64
void addrcache_id_group                        ( AddressCache *cache, ItemGroup *group );
65
void addrcache_id_folder                ( AddressCache *cache, ItemFolder *folder );
66
void addrcache_id_email                        ( AddressCache *cache, ItemEMail *email );
67
void addrcache_id_attribute                ( AddressCache *cache, UserAttribute *attrib );
68

    
69
gboolean addrcache_hash_add_person        ( AddressCache *cache, ItemPerson *person );
70
gboolean addrcache_hash_add_group        ( AddressCache *cache, ItemGroup *group );
71
gboolean addrcache_hash_add_folder        ( AddressCache *cache, ItemFolder *folder );
72

    
73
gboolean addrcache_folder_add_person        ( AddressCache *cache, ItemFolder *folder, ItemPerson *item );
74
gboolean addrcache_folder_add_folder        ( AddressCache *cache, ItemFolder *folder, ItemFolder *item );
75
gboolean addrcache_folder_add_group        ( AddressCache *cache, ItemFolder *folder, ItemGroup *item );
76

    
77
gboolean addrcache_add_person                ( AddressCache *cache, ItemPerson *person );
78
gboolean addrcache_add_group                ( AddressCache *cache, ItemGroup *group );
79
gboolean addrcache_person_add_email        ( AddressCache *cache, ItemPerson *person, ItemEMail *email );
80
gboolean addrcache_group_add_email        ( AddressCache *cache, ItemGroup *group, ItemEMail *email );
81
gboolean addrcache_add_folder                ( AddressCache *cache, ItemFolder *folder );
82

    
83
AddrItemObject *addrcache_get_object        ( AddressCache *cache, const gchar *uid );
84
ItemPerson *addrcache_get_person        ( AddressCache *cache, const gchar *uid );
85
ItemGroup *addrcache_get_group                ( AddressCache *cache, const gchar *uid );
86
ItemEMail *addrcache_get_email                ( AddressCache *cache, const gchar *uid, const gchar *eid );
87

    
88
UserAttribute *addrcache_person_remove_attrib_id        ( AddressCache *cache, const gchar *uid,
89
                                                          const gchar *aid );
90
UserAttribute *addrcache_person_remove_attribute        ( AddressCache *cache, ItemPerson *person,
91
                                                          UserAttribute *attrib );
92

    
93
ItemGroup *addrcache_remove_group_id                ( AddressCache *cache, const gchar *uid );
94
ItemGroup *addrcache_remove_group                ( AddressCache *cache, ItemGroup *group );
95

    
96
ItemPerson *addrcache_remove_person_id                ( AddressCache *cache, const gchar *uid );
97
ItemPerson *addrcache_remove_person                ( AddressCache *cache, ItemPerson *person );
98
ItemEMail *addrcache_person_remove_email_id        ( AddressCache *cache, const gchar *uid, const gchar *eid );
99
ItemEMail *addrcache_person_remove_email        ( AddressCache *cache, ItemPerson *person, ItemEMail *email );
100

    
101
GList *addrcache_folder_get_address_list        ( AddressCache *cache, ItemFolder *folder );
102
GList *addrcache_folder_get_person_list                ( AddressCache *cache, ItemFolder *folder );
103
GList *addrcache_folder_get_group_list                ( AddressCache *cache, ItemFolder *folder );
104
GList *addrcache_folder_get_folder_list                ( AddressCache *cache, ItemFolder *folder );
105

    
106
GList *addrcache_get_address_list                ( AddressCache *cache );
107
GList *addrcache_get_person_list                ( AddressCache *cache );
108
GList *addrcache_get_group_list                        ( AddressCache *cache );
109
GList *addrcache_get_folder_list                ( AddressCache *cache );
110

    
111
GList *addrcache_get_group_for_person                ( AddressCache *cache, ItemPerson *person );
112

    
113
ItemFolder *addrcache_find_root_folder                ( ItemFolder *folder );
114
GList *addrcache_get_all_persons                ( AddressCache *cache );
115
GList *addrcache_get_all_groups                        ( AddressCache *cache );
116

    
117
ItemFolder *addrcache_remove_folder                ( AddressCache *cache, ItemFolder *folder );
118
ItemFolder *addrcache_remove_folder_delete        ( AddressCache *cache, ItemFolder *folder );
119

    
120
ItemPerson *addrcache_add_contact                ( AddressCache *cache, ItemFolder *folder,
121
                                                  const gchar *name, const gchar *address,
122
                                                  const gchar *remarks ); 
123

    
124
#endif /* __ADDRCACHE_H__ */