aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-message-cache.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-09-10 04:28:35 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-09-10 04:28:35 +0800
commit4a52b7b9a9c00a9cb5fecca624c8f5590081e316 (patch)
tree531f6e1f4c876f2f74390e22e2b2ed232d0d75fd /camel/providers/imap/camel-imap-message-cache.c
parent8269bb5271a836ce733917cb2550d9d1ac5b7f31 (diff)
downloadgsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.gz
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.bz2
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.lz
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.xz
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.zst
gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.zip
Fixes bug #4224
2002-09-09 Jeffrey Stedfast <fejj@ximian.com> Fixes bug #4224 * providers/imap/camel-imap-folder.c (camel_imap_folder_fetch_data): Pass ex into camel_imap_message_cache_get(). * providers/imap/camel-imap-message-cache.c (camel_imap_message_cache_get): Now takes an exception and sets it on fail. (camel_imap_message_cache_copy): Updated to properly handle cache_get error conditions. svn path=/trunk/; revision=18027
Diffstat (limited to 'camel/providers/imap/camel-imap-message-cache.c')
-rw-r--r--camel/providers/imap/camel-imap-message-cache.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/camel/providers/imap/camel-imap-message-cache.c b/camel/providers/imap/camel-imap-message-cache.c
index 0701ca45e4..559c6d2f88 100644
--- a/camel/providers/imap/camel-imap-message-cache.c
+++ b/camel/providers/imap/camel-imap-message-cache.c
@@ -384,20 +384,21 @@ camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache,
* @cache: the cache
* @uid: the UID of the data to get
* @part_spec: the part_spec of the data to get
+ * @ex: exception
*
* Return value: a CamelStream containing the cached data (which the
* caller must unref), or %NULL if that data is not cached.
**/
CamelStream *
camel_imap_message_cache_get (CamelImapMessageCache *cache, const char *uid,
- const char *part_spec)
+ const char *part_spec, CamelException *ex)
{
CamelStream *stream;
char *path, *key;
-
+
if (uid[0] == 0)
return NULL;
-
+
path = g_strdup_printf ("%s/%s.%s", cache->path, uid, part_spec);
key = strrchr (path, '/') + 1;
stream = g_hash_table_lookup (cache->parts, key);
@@ -409,8 +410,14 @@ camel_imap_message_cache_get (CamelImapMessageCache *cache, const char *uid,
}
stream = camel_stream_fs_new_with_name (path, O_RDONLY, 0);
- if (stream)
+ if (stream) {
cache_put (cache, uid, key, stream);
+ } else {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Failed to cache %s: %s"),
+ part_spec, g_strerror (errno));
+ }
+
g_free (path);
return stream;
@@ -502,17 +509,19 @@ camel_imap_message_cache_copy (CamelImapMessageCache *source,
CamelStream *stream;
char *part;
int i;
-
+
subparts = g_hash_table_lookup (source->parts, source_uid);
if (!subparts || !subparts->len)
return;
-
+
for (i = 0; i < subparts->len; i++) {
part = strchr (subparts->pdata[i], '.');
if (!part++)
continue;
- stream = camel_imap_message_cache_get (source, source_uid, part);
- camel_imap_message_cache_insert_stream (dest, dest_uid, part, stream, ex);
- camel_object_unref (CAMEL_OBJECT (stream));
+
+ if ((stream = camel_imap_message_cache_get (source, source_uid, part, ex))) {
+ camel_imap_message_cache_insert_stream (dest, dest_uid, part, stream, ex);
+ camel_object_unref (CAMEL_OBJECT (stream));
+ }
}
}