aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-message-cache.h
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-16 04:50:59 +0800
committerDan Winship <danw@src.gnome.org>2001-03-16 04:50:59 +0800
commit1f9d06c2aac1805bbd3922991d8332b44f16ad3e (patch)
tree0b363d1cb7795c0c20f4f734541b70291d09c213 /camel/providers/imap/camel-imap-message-cache.h
parent892997d8c0f0cc6105ca8b0a8a369b97aab45dcb (diff)
downloadgsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar.gz
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar.bz2
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar.lz
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar.xz
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.tar.zst
gsoc2013-evolution-1f9d06c2aac1805bbd3922991d8332b44f16ad3e.zip
First batch of disconnected IMAP-related stuff. This adds local
caching of message parts, but NOT any actual disconnected support. (But it should speed up IMAP use.) * providers/imap/camel-imap-message-cache.c: New class for caching message data to disk, and removing it when it's no longer relevant. Will eventually also support merging message parts together to save on files. Or maybe using a db instead of files? * providers/imap/camel-imap-private.h: Add a cache_lock to CamelImapFolderPrivate. This lock must be recursive, so make both locks EMutexes rather than GMutex. * providers/imap/camel-imap-folder.c (parse_fetch_response): "The only FETCH response parser you need!" Replaces the various almost-correct bits of code formerly scattered throughout this file with a single fully-correct function that can handle any FETCH response at any time, so we don't get confused by seeing a flags update when we were only expecting a message body, etc. (camel_imap_folder_fetch_data): FETCH a message body part either from the cache or the server (camel_imap_folder_changed): Remove expunged messages from the message cache. (camel_imap_folder_new): Change to take a directory instead of a summary file name. Create a CamelImapMessageCache for the folder. (imap_finalize): Unref the message cache. (camel_imap_folder_selected, imap_rescan, get_content, get_message, imap_get_message, imap_update_summary): Redone a bunch to use parse_fetch_data, CamelImapMessageCache, etc. * providers/imap/camel-imap-store.c (get_folder): Pass directory name to camel_imap_folder_new, not summary filename. Use e_path_to_physical to generate a path with /subfolders/ inserted between directory components. * providers/imap/camel-imap-wrapper.c (camel_imap_wrapper_new): Call camel_imap_folder_fetch_data (with cache_only TRUE) and if the data is cached, return an online datawrapper rather than an offline one. (write_to_stream): Use camel_imap_folder_fetch_data (with cache_only FALSE) here too * providers/imap/camel-imap-utils.c (imap_skip_list): Renamed from skip_list and made non-static. svn path=/trunk/; revision=8743
Diffstat (limited to 'camel/providers/imap/camel-imap-message-cache.h')
-rw-r--r--camel/providers/imap/camel-imap-message-cache.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/camel/providers/imap/camel-imap-message-cache.h b/camel/providers/imap/camel-imap-message-cache.h
new file mode 100644
index 0000000000..1ac48086ae
--- /dev/null
+++ b/camel/providers/imap/camel-imap-message-cache.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-imap-message-cache.h: Class for an IMAP message cache */
+
+/*
+ * Author:
+ * Dan Winship <danw@ximian.com>
+ *
+ * Copyright (C) 2001 Ximian, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+
+#ifndef CAMEL_IMAP_MESSAGE_CACHE_H
+#define CAMEL_IMAP_MESSAGE_CACHE_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus }*/
+
+#include "camel-imap-types.h"
+#include "camel-folder.h"
+#include <camel/camel-folder-search.h>
+
+#define CAMEL_IMAP_MESSAGE_CACHE_TYPE (camel_imap_message_cache_get_type ())
+#define CAMEL_IMAP_MESSAGE_CACHE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_MESSAGE_CACHE_TYPE, CamelImapFolder))
+#define CAMEL_IMAP_MESSAGE_CACHE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_MESSAGE_CACHE_TYPE, CamelImapFolderClass))
+#define CAMEL_IS_IMAP_MESSAGE_CACHE(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_MESSAGE_CACHE_TYPE))
+
+struct _CamelImapMessageCache {
+ CamelObject parent_object;
+
+ char *path;
+ GHashTable *parts, *cached;
+};
+
+
+typedef struct {
+ CamelFolderClass parent_class;
+
+ /* Virtual methods */
+
+} CamelImapMessageCacheClass;
+
+
+/* public methods */
+CamelImapMessageCache *camel_imap_message_cache_new (const char *path,
+ CamelFolderSummary *summ,
+ CamelException *ex);
+
+CamelStream *camel_imap_message_cache_insert (CamelImapMessageCache *cache,
+ const char *uid,
+ const char *part_spec,
+ const char *data,
+ int len);
+CamelStream *camel_imap_message_cache_get (CamelImapMessageCache *cache,
+ const char *uid,
+ const char *part_spec);
+void camel_imap_message_cache_remove (CamelImapMessageCache *cache,
+ const char *uid);
+
+
+/* Standard Camel function */
+CamelType camel_imap_message_cache_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_IMAP_MESSAGE_CACHE_H */