aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-03-04 06:26:13 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-04 06:26:13 +0800
commit41694524a6b39908c8c7a5e298f252c488416afd (patch)
tree35a04aefd33893af9d83c872919cca2216167a89
parentf073038b91db7859f22c240c82226e4741228a7f (diff)
downloadgsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar.gz
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar.bz2
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar.lz
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar.xz
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.tar.zst
gsoc2013-evolution-41694524a6b39908c8c7a5e298f252c488416afd.zip
use set_input_stream instead of construct_from_stream to feed the message
2000-03-03 bertrand <bertrand@helixcode.com> * 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
-rw-r--r--camel/ChangeLog14
-rw-r--r--camel/camel-data-wrapper.c16
-rw-r--r--camel/camel-mime-part.c23
-rw-r--r--camel/camel-simple-data-wrapper.c8
-rw-r--r--camel/camel-stream-fs.c4
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c6
6 files changed, 58 insertions, 13 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 5aaf1953a8..0362ea33ce 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,17 @@
+2000-03-03 bertrand <bertrand@helixcode.com>
+
+ * 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.
+
2000-03-03 NotZed <NotZed@HelixCode.com>
* providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): Make
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;
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 57b2659ffb..4c2ecca805 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -659,14 +659,27 @@ my_get_content_object (CamelMedium *medium)
static void
my_write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
{
- CamelMedium *medium = CAMEL_MEDIUM (mime_part);
+ CamelMedium *medium;
CamelStream *wrapper_stream;
CamelStreamB64 *stream_b64;
- CamelDataWrapper *content = medium->content;
+ CamelDataWrapper *content;
+
CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::_write_content_to_stream\n");
CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::_write_content_to_stream, content=%p\n", content);
- if (!content) return;
+
+ g_assert (mime_part);
+
+ medium = CAMEL_MEDIUM (mime_part);
+ content = medium->content;
+
+ if (!content) {
+ content = camel_medium_get_content_object (mime_part);
+ }
+
+ if (!content) {
+ return;
+ }
switch (mime_part->encoding) {
case CAMEL_MIME_PART_ENCODING_DEFAULT:
@@ -677,6 +690,7 @@ my_write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
case CAMEL_MIME_PART_ENCODING_BASE64:
/* encode the data wrapper output stream in base 64 ... */
wrapper_stream = camel_data_wrapper_get_output_stream (content);
+ camel_stream_reset (wrapper_stream);
stream_b64 = CAMEL_STREAM_B64 (camel_stream_b64_new_with_input_stream (wrapper_stream));
camel_stream_b64_set_mode (stream_b64, CAMEL_STREAM_B64_ENCODER);
@@ -858,8 +872,7 @@ my_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream,
content_stream_inf_bound,
-1);
-
-
+
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream leaving\n");
}
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
index a1822e8bcf..2b603d5ef3 100644
--- a/camel/camel-simple-data-wrapper.c
+++ b/camel/camel-simple-data-wrapper.c
@@ -138,12 +138,14 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
g_assert (data_wrapper);
g_assert (stream);
- g_assert (simple_data_wrapper->byte_array);
+
array = simple_data_wrapper->byte_array;
- if (array->len)
+ if ( array && array->len)
camel_stream_write (stream, (gchar *)array->data, array->len);
+ else
+ parent_class->write_to_stream (data_wrapper, stream);
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving my_write_to_stream\n");
+ CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving my_write_to_stream\n");
}
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 4455c40b2b..db12a421e0 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -486,12 +486,12 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy)
gint real_offset;
CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
-#if 0
+
/* because we don't know what is going to happen, we
set the eof stream to false so that a reread can
occur */
stream_fs->eof = FALSE;
-#endif
+
switch (policy) {
case CAMEL_STREAM_SET:
real_offset = MAX (stream_fs->inf_bound + offset, stream_fs->inf_bound);
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 5b37bee6e7..651580a5ff 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -965,7 +965,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
close (fd2);
/* remove the temporary file */
- unlink (tmp_message_filename);
+ //unlink (tmp_message_filename);
/* generate the folder md5 signature */
md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest);
@@ -1067,7 +1067,9 @@ _get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
message = camel_mime_message_new_with_session (camel_service_get_session (CAMEL_SERVICE (parent_store)));
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), message_stream);
+ //camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), message_stream);
+ camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (message), message_stream);
+