aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-multipart.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-03 18:19:39 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 18:19:39 +0800
commite9c6d8921cce940e590f763a881794323a9e6703 (patch)
treed8e989d8119fe6d8c825364c0b7dd16c6c2179be /camel/camel-multipart.c
parentbba2b0a352933d8aa8894fe1b7a8a5185378990f (diff)
downloadgsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.gz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.bz2
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.lz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.xz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.zst
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.zip
Multipart Mime message parsing works with plain text parts. Woohooo :))))
Making it work with other types is now just a matter of writing the various data wrappers. And display them will just be a matter of writing the good bonobo components. 1999-08-03 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-simple-data-wrapper.c (_construct_from_stream): more debugging output + nb_bytes_read is now a signed int to avoid bug when eos is encountered. * camel/camel-mime-part.c (_construct_from_stream): sync to data_wrapper_repository function name changes. Use default "text/plain" type when conten-type field is not found. (following RFC 2046 spec). * camel/data-wrapper-repository.c (data_wrapper_repository_set_data_wrapper_type): (data_wrapper_repository_get_data_wrapper_type): change function name prefix (s/data_wrapper/data_wrapper_repository/) * camel/camel-multipart.c (_read_part): add `\n` at eol but not before boundary. * camel/gmime-utils.c (get_header_table_from_stream): correct implementation of end of stream detection. svn path=/trunk/; revision=1070
Diffstat (limited to 'camel/camel-multipart.c')
-rw-r--r--camel/camel-multipart.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index e0cf2861ac..8362259ea6 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -379,11 +379,13 @@ _read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_bou
gchar *new_line;
gboolean end_of_part = FALSE;
gboolean last_part = FALSE;
+ gboolean first_line = TRUE;
+ /* Note for future enhancements */
/* RFC 2046 precises that when parsing the content of a multipart
- * element, the program should not think it will find the last bounndary,
+ * element, the program should not think it will find the last boundary,
* and in particular, the message could have been damaged during
- * transport, the parsing should be OK */
+ * transport, the parsing should still be OK */
CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering _read_part\n");
new_line = gmime_read_line_from_stream (stream);
@@ -392,13 +394,17 @@ _read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_bou
printf ("++ new line = \"%s\"\n", new_line);
end_of_part = (strcmp (new_line, normal_boundary) == 0);
last_part = (strcmp (new_line, end_boundary) == 0);
- if (!end_of_part && !last_part)
- /* new_part = g_string_append (new_part, new_line); */
- camel_stream_write_string (new_part_stream, new_line);
- new_line = gmime_read_line_from_stream (stream);
+ if (!end_of_part && !last_part) {
+ if (first_line) {
+ camel_stream_write_string (new_part_stream, "\n");
+ first_line = FALSE;
+ }
+ camel_stream_write_strings (new_part_stream, "\n", new_line, NULL);
+ new_line = gmime_read_line_from_stream (stream);
+ }
}
CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n");
- return (last_part && !new_line);
+ return (last_part || (new_line == NULL));
}
static void
@@ -423,7 +429,9 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
/* read the prefix if any */
- //end_of_multipart = _read_part (new_part, stream, real_boundary_line, end_boundary_line);
+ new_part_stream = camel_stream_mem_new (CAMEL_STREAM_MEM_RW);
+ end_of_multipart = _read_part (new_part_stream, stream, real_boundary_line, end_boundary_line);
+ gtk_object_destroy (GTK_OBJECT (new_part_stream));
if (multipart->preface) g_free (multipart->preface);
//if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str);