Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / imap / camel-imap-message-cache.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-imap-message-cache.h: Class for an IMAP message cache */
3
4 /* 
5  * Author: 
6  *   Dan Winship <danw@ximian.com>
7  *
8  * Copyright (C) 2001 Ximian, Inc. (www.ximian.com)
9  *
10  * This program is free software; you can redistribute it and/or 
11  * modify it under the terms of version 2 of the GNU Lesser General Public 
12  * License as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24
25
26 #ifndef CAMEL_IMAP_MESSAGE_CACHE_H
27 #define CAMEL_IMAP_MESSAGE_CACHE_H 1
28
29 #include "camel-imap-types.h"
30 #include "camel-folder.h"
31 #include <camel/camel-folder-search.h>
32
33 #define CAMEL_IMAP_MESSAGE_CACHE_TYPE     (camel_imap_message_cache_get_type ())
34 #define CAMEL_IMAP_MESSAGE_CACHE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_MESSAGE_CACHE_TYPE, CamelImapFolder))
35 #define CAMEL_IMAP_MESSAGE_CACHE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_MESSAGE_CACHE_TYPE, CamelImapFolderClass))
36 #define CAMEL_IS_IMAP_MESSAGE_CACHE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_MESSAGE_CACHE_TYPE))
37
38 G_BEGIN_DECLS
39
40 struct _CamelImapMessageCache {
41         CamelObject parent_object;
42
43         char *path;
44         GHashTable *parts, *cached;
45         guint32 max_uid;
46 };
47
48
49 typedef struct {
50         CamelFolderClass parent_class;
51
52         /* Virtual methods */   
53         
54 } CamelImapMessageCacheClass;
55
56
57 /* public methods */
58 CamelImapMessageCache *camel_imap_message_cache_new (const char *path,
59                                                      CamelFolderSummary *summ,
60                                                      CamelException *ex);
61
62 void camel_imap_message_cache_set_path (CamelImapMessageCache *cache,
63                                         const char *path);
64
65 guint32     camel_imap_message_cache_max_uid (CamelImapMessageCache *cache);
66
67 CamelStream *camel_imap_message_cache_insert (CamelImapMessageCache *cache,
68                                               const char *uid,
69                                               const char *part_spec,
70                                               const char *data,
71                                               int len,
72                                               CamelException *ex);
73 void camel_imap_message_cache_insert_stream  (CamelImapMessageCache *cache,
74                                               const char *uid,
75                                               const char *part_spec,
76                                               CamelStream *data_stream,
77                                               CamelException *ex);
78 void camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache,
79                                               const char *uid,
80                                               const char *part_spec,
81                                               CamelDataWrapper *wrapper,
82                                               CamelException *ex);
83
84 CamelStream *camel_imap_message_cache_get    (CamelImapMessageCache *cache,
85                                               const char *uid,
86                                               const char *part_spec,
87                                               CamelException *ex);
88
89 void         camel_imap_message_cache_remove (CamelImapMessageCache *cache,
90                                               const char *uid);
91
92 void         camel_imap_message_cache_clear  (CamelImapMessageCache *cache);
93
94 void         camel_imap_message_cache_copy   (CamelImapMessageCache *source,
95                                               const char *source_uid,
96                                               CamelImapMessageCache *dest,
97                                               const char *dest_uid,
98                                               CamelException *ex);
99
100 /* Standard Camel function */
101 CamelType camel_imap_message_cache_get_type (void);
102
103 G_END_DECLS
104
105 #endif /* CAMEL_IMAP_MESSAGE_CACHE_H */