[evolution-exchange] Bug #631034 - Message cache keeps zero-sized mails on cancel
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-exchange] Bug #631034 - Message cache keeps zero-sized mails on cancel
- Date: Mon, 4 Oct 2010 08:43:29 +0000 (UTC)
commit 1309bc5f24188bdc0d4bbae70e16901f1fddcd09
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 4 10:42:51 2010 +0200
Bug #631034 - Message cache keeps zero-sized mails on cancel
camel/camel-exchange-folder.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-exchange-folder.c b/camel/camel-exchange-folder.c
index 0b670ae..ed04e15 100644
--- a/camel/camel-exchange-folder.c
+++ b/camel/camel-exchange-folder.c
@@ -84,10 +84,9 @@ exchange_folder_append_message_data (CamelFolder *folder,
stream_cache = camel_data_cache_add (
exch->cache, "cache", new_uid, NULL);
if (stream_cache) {
- camel_stream_write (stream_cache,
- (gchar *) message->data,
- message->len, cancellable, NULL);
- camel_stream_flush (stream_cache, cancellable, NULL);
+ if (camel_stream_write (stream_cache, (gchar *) message->data, message->len, cancellable, NULL) <= 0 ||
+ camel_stream_flush (stream_cache, cancellable, NULL) == -1)
+ camel_data_cache_remove (exch->cache, "cache", new_uid, NULL);
g_object_unref (stream_cache);
}
if (appended_uid)
@@ -121,6 +120,17 @@ exchange_folder_get_message_data (CamelFolder *folder,
stream = camel_data_cache_get (exch->cache, "cache", uid, NULL);
if (stream) {
+ CamelStream *null_stream = camel_stream_null_new ();
+
+ camel_stream_reset (stream, NULL);
+ if (camel_stream_write_to_stream (stream, null_stream, cancellable, NULL) <= 0) {
+ stream = NULL;
+ }
+
+ g_object_unref (null_stream);
+ }
+
+ if (stream) {
ba = g_byte_array_new ();
stream_mem = camel_stream_mem_new ();
camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream_mem), ba);
@@ -150,8 +160,9 @@ exchange_folder_get_message_data (CamelFolder *folder,
return NULL;
}
- camel_stream_write (stream, (gchar *) ba->data, ba->len, cancellable, NULL);
- camel_stream_flush (stream, cancellable, NULL);
+ if (camel_stream_write (stream, (gchar *) ba->data, ba->len, cancellable, NULL) <= 0 ||
+ camel_stream_flush (stream, cancellable, NULL) == -1)
+ camel_data_cache_remove (exch->cache, "cache", uid, NULL);
g_object_unref (stream);
return ba;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]