diff options
-rw-r--r-- | em-format/em-format-quote.c | 8 | ||||
-rw-r--r-- | em-format/em-format.c | 3 | ||||
-rw-r--r-- | em-format/em-inline-filter.c | 2 | ||||
-rw-r--r-- | mail/e-mail-folder-utils.c | 22 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 1 | ||||
-rw-r--r-- | modules/mail/e-mail-attachment-handler.c | 2 | ||||
-rw-r--r-- | modules/plugin-mono/Camel.cs | 6 |
7 files changed, 24 insertions, 20 deletions
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index a8f1bf329a..a5a8d0de65 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -94,8 +94,11 @@ emfq_format_clone (EMFormat *emf, EM_FORMAT_CLASS (parent_class)->format_clone ( emf, folder, uid, msg, src, cancellable); + g_seekable_seek ( + G_SEEKABLE (emfq->priv->stream), + 0, G_SEEK_SET, NULL, NULL); + gconf = gconf_client_get_default (); - camel_stream_reset (emfq->priv->stream, NULL); if (gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/top_signature", NULL)) camel_stream_printf (emfq->priv->stream, "<br>\n"); @@ -257,6 +260,9 @@ em_format_quote_new (const gchar *credits, g_return_val_if_fail (CAMEL_IS_STREAM (stream), NULL); + /* Steam must also be seekable so we can reset its position. */ + g_return_val_if_fail (G_IS_SEEKABLE (stream), NULL); + emfq = g_object_new (EM_TYPE_FORMAT_QUOTE, NULL); emfq->priv->credits = g_strdup (credits); diff --git a/em-format/em-format.c b/em-format/em-format.c index 1f9634d29f..1c2624f1f6 100644 --- a/em-format/em-format.c +++ b/em-format/em-format.c @@ -1422,7 +1422,8 @@ em_format_format_text (EMFormat *emf, (CamelStream *) filter_stream, cancellable, NULL); camel_stream_flush ((CamelStream *) filter_stream, cancellable, NULL); g_object_unref (filter_stream); - camel_stream_reset (mem_stream, NULL); + + g_seekable_seek (G_SEEKABLE (mem_stream), 0, G_SEEK_SET, NULL, NULL); if (max == -1 || size == -1 || size < (max * 1024) || emf->composer) { camel_stream_write_to_stream ( diff --git a/em-format/em-inline-filter.c b/em-format/em-inline-filter.c index c7a8014f6b..1f9639540e 100644 --- a/em-format/em-inline-filter.c +++ b/em-format/em-inline-filter.c @@ -121,7 +121,7 @@ inline_filter_add_part (EMInlineFilter *emif, const gchar *data, gint len) } emif->data = g_byte_array_new (); - camel_stream_reset (mem, NULL); + g_seekable_seek (G_SEEKABLE (mem), 0, G_SEEK_SET, NULL, NULL); dw = camel_data_wrapper_new (); if (encoding == emif->base_encoding && (encoding == CAMEL_TRANSFER_ENCODING_BASE64 || encoding == CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE)) { diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c index f255c730b6..64bdbdb821 100644 --- a/mail/e-mail-folder-utils.c +++ b/mail/e-mail-folder-utils.c @@ -1159,9 +1159,7 @@ e_mail_folder_save_messages_sync (CamelFolder *folder, { GFileOutputStream *file_output_stream; GByteArray *byte_array; - CamelMimeFilter *filter; CamelStream *base_stream; - CamelStream *stream; gboolean success = TRUE; guint ii; @@ -1192,15 +1190,12 @@ e_mail_folder_save_messages_sync (CamelFolder *folder, /* CamelStreamMem takes ownership of the GByteArray. */ byte_array = g_byte_array_new (); - filter = camel_mime_filter_from_new (); base_stream = camel_stream_mem_new_with_byte_array (byte_array); - stream = camel_stream_filter_new (base_stream); - camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), filter); - g_object_unref (base_stream); - g_object_unref (filter); for (ii = 0; ii < message_uids->len; ii++) { CamelMimeMessage *message; + CamelMimeFilter *filter; + CamelStream *stream; const gchar *uid; gchar *from_line; gint percent; @@ -1232,10 +1227,17 @@ e_mail_folder_save_messages_sync (CamelFolder *folder, goto exit; } + filter = camel_mime_filter_from_new (); + stream = camel_stream_filter_new (base_stream); + camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), filter); + retval = camel_data_wrapper_write_to_stream_sync ( CAMEL_DATA_WRAPPER (message), stream, cancellable, error); + g_object_unref (filter); + g_object_unref (stream); + if (retval == -1) { g_object_unref (message); goto exit; @@ -1258,14 +1260,16 @@ e_mail_folder_save_messages_sync (CamelFolder *folder, /* Flush the buffer for the next message. * For memory streams this never fails. */ - camel_stream_reset (stream, NULL); + g_seekable_seek ( + G_SEEKABLE (base_stream), + 0, G_SEEK_SET, NULL, NULL); g_object_unref (message); } exit: g_object_unref (file_output_stream); - g_object_unref (stream); + g_object_unref (base_stream); camel_operation_pop_message (cancellable); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 2dcc6872af..c3b5465015 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1153,7 +1153,6 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont if (replace_variables (clues, message, &str)) { stream = camel_stream_mem_new_with_buffer (str, strlen (str)); - camel_stream_reset (stream, NULL); camel_data_wrapper_construct_from_stream_sync ( content, stream, NULL, NULL); g_object_unref (stream); diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index e65e6871c2..e6493f2f77 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -221,7 +221,7 @@ mail_attachment_handler_message_rfc822 (EAttachmentView *view, stream = camel_stream_mem_new (); camel_stream_write (stream, data, length, NULL, NULL); - camel_stream_reset (stream, NULL); + g_seekable_seek (G_SEEKABLE (stream), 0, G_SEEK_SET, NULL, NULL); message = camel_mime_message_new (); wrapper = CAMEL_DATA_WRAPPER (message); diff --git a/modules/plugin-mono/Camel.cs b/modules/plugin-mono/Camel.cs index c415498c02..21fbe468f4 100644 --- a/modules/plugin-mono/Camel.cs +++ b/modules/plugin-mono/Camel.cs @@ -630,7 +630,6 @@ namespace Camel { [DllImport("camel-1.2")] static extern int camel_stream_eos(IntPtr o); [DllImport("camel-1.2")] static extern int camel_stream_close(IntPtr o); [DllImport("camel-1.2")] static extern int camel_stream_flush(IntPtr o); - [DllImport("camel-1.2")] static extern int camel_stream_reset(IntPtr o); public int write(byte [] data, int len) { int ret; @@ -671,11 +670,6 @@ namespace Camel { throw new Exception(Exception.Type.SYSTEM, "IO close Error"); } - public void reset() { - if (camel_stream_reset(cobject) == -1) - throw new Exception(Exception.Type.SYSTEM, "IO reset Error"); - } - public void flush() { if (camel_stream_flush(cobject) == -1) throw new Exception(Exception.Type.SYSTEM, "IO close Error"); |