diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-09-10 04:28:35 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-09-10 04:28:35 +0800 |
commit | 4a52b7b9a9c00a9cb5fecca624c8f5590081e316 (patch) | |
tree | 531f6e1f4c876f2f74390e22e2b2ed232d0d75fd /camel/providers/imap | |
parent | 8269bb5271a836ce733917cb2550d9d1ac5b7f31 (diff) | |
download | gsoc2013-evolution-4a52b7b9a9c00a9cb5fecca624c8f5590081e316.tar.gz 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')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-message-cache.c | 27 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-message-cache.h | 4 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 2 |
4 files changed, 28 insertions, 14 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 1a2f5a79e9..0f77d80d75 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -2410,9 +2410,12 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid, CAMEL_SERVICE_LOCK (store, connect_lock); CAMEL_IMAP_FOLDER_LOCK (imap_folder, cache_lock); - stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text); - if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0"))) - stream = camel_imap_message_cache_get (imap_folder->cache, uid, ""); + stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex); + if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0"))) { + camel_exception_clear (ex); + stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex); + } + if (stream || cache_only) { CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock); CAMEL_SERVICE_UNLOCK (store, connect_lock); 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)); + } } } diff --git a/camel/providers/imap/camel-imap-message-cache.h b/camel/providers/imap/camel-imap-message-cache.h index eb3f056b44..c79195cfa4 100644 --- a/camel/providers/imap/camel-imap-message-cache.h +++ b/camel/providers/imap/camel-imap-message-cache.h @@ -87,7 +87,9 @@ void camel_imap_message_cache_insert_wrapper (CamelImapMessageCache *cache, CamelStream *camel_imap_message_cache_get (CamelImapMessageCache *cache, const char *uid, - const char *part_spec); + const char *part_spec, + CamelException *ex); + void camel_imap_message_cache_remove (CamelImapMessageCache *cache, const char *uid); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index af4192e0c6..f095c664db 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -1223,7 +1223,7 @@ imap_connect_online (CamelService *service, CamelException *ex) if (!store->namespace) store->namespace = g_strdup (""); - + if (!store->dir_sep) { if (store->server_level >= IMAP_LEVEL_IMAP4REV1) { /* This idiom means "tell me the hierarchy separator |