From 41694524a6b39908c8c7a5e298f252c488416afd Mon Sep 17 00:00:00 2001 From: bertrand Date: Fri, 3 Mar 2000 22:26:13 +0000 Subject: use set_input_stream instead of construct_from_stream to feed the message 2000-03-03 bertrand * providers/mbox/camel-mbox-folder.c (_get_message_by_uid): use set_input_stream instead of construct_from_stream to feed the message object. * camel-data-wrapper.c (my_write_to_stream): reset output stream. (my_set_input_stream): unref the previous input stream. use the set_output_stream for default behaviour. (my_set_output_stream): unref previous output stream. * camel-mime-part.c (my_write_content_to_stream): reset content object output stream. mbox provider now also constructs message bodies. I should have looked here first. damn. svn path=/trunk/; revision=2030 --- camel/camel-data-wrapper.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'camel/camel-data-wrapper.c') diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index cd4fcce7de..6f6aac6a16 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -145,9 +145,14 @@ static void my_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { g_assert (data_wrapper); + + if (data_wrapper->input_stream) + gtk_object_unref (GTK_OBJECT (data_wrapper->input_stream)); + data_wrapper->input_stream = stream; + if (!data_wrapper->output_stream && stream) - data_wrapper->output_stream = stream; + my_set_output_stream (data_wrapper, stream); if (stream) gtk_object_ref (GTK_OBJECT (stream)); @@ -186,6 +191,10 @@ static void my_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { g_assert (data_wrapper); + + if (data_wrapper->output_stream) + gtk_object_unref (GTK_OBJECT (data_wrapper->output_stream)); + data_wrapper->output_stream = stream; if (stream) gtk_object_ref (GTK_OBJECT (stream)); @@ -251,6 +260,11 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) output_stream = camel_data_wrapper_get_output_stream (data_wrapper); + if (!output_stream) + return; + + camel_stream_reset (output_stream); + while (!camel_stream_eos (output_stream)) { nb_read = camel_stream_read (output_stream, tmp_buf, 4096); nb_written = 0; -- cgit v1.2.3