[evolution-data-server/evolution-data-server-3-12] Bug 729172 - [IMAPx] Cannot retrieve certain messages



commit d3e25541d16e284bb7bf89ddbfde13a7a56f6078
Author: Ian Campbell <ijc hellion org uk>
Date:   Wed Jul 2 10:50:27 2014 +0200

    Bug 729172 - [IMAPx] Cannot retrieve certain messages

 camel/providers/imapx/camel-imapx-server.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index ef2bb32..0b8a0c4 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2178,7 +2178,6 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
                        GOutputStream *output_stream;
                        gconstpointer body_data;
                        gsize body_size;
-                       gboolean success;
 
                        if (data->use_multi_fetch) {
                                data->body_offset = finfo->offset;
@@ -2193,15 +2192,18 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
 
                        body_data = g_bytes_get_data (finfo->body, &body_size);
 
-                       success = g_output_stream_write_all (
-                               output_stream, body_data, body_size,
-                               NULL, cancellable, error);
-
-                       if (!success) {
-                               g_prefix_error (
-                                       error, "%s: ",
-                                       _("Error writing to cache stream"));
-                               return FALSE;
+                       /* Sometimes the server, like Microsoft Exchange, reports larger message
+                          size than it actually is, which results in no data being read from
+                          the server for that particular offset. */
+                       if (body_size) {
+                               if (!g_output_stream_write_all (
+                                       output_stream, body_data, body_size,
+                                       NULL, cancellable, error)) {
+                                       g_prefix_error (
+                                               error, "%s: ",
+                                               _("Error writing to cache stream"));
+                                       return FALSE;
+                               }
                        }
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]