aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 21:16:35 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 21:16:35 +0800
commit382308f44a4ab93659f9f54c8dac2c2cc381a471 (patch)
tree40d0f4d6d70f8ee6a8a01b7f9c6bf310732455d0 /camel/camel-mime-part.c
parente9c6d8921cce940e590f763a881794323a9e6703 (diff)
downloadgsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar.gz
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar.bz2
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar.lz
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar.xz
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.tar.zst
gsoc2013-evolution-382308f44a4ab93659f9f54c8dac2c2cc381a471.zip
There is a probleme here. We can not allow mime part content-type field
* camel/camel-mime-part.c (_set_content_object): There is a probleme here. We can not allow mime part content-type field and content_object mime-type to be different. I thus chosed to set mime part object content field to be freed (if necessary) and set to be a pointer to content_object mime type field. (_construct_from_stream): set content_object mime type to be the same as mime_part's one. This is necessary because we use _set_content_type. This two things are a bit hackish ansd may need to be redesigned. svn path=/trunk/; revision=1071
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r--camel/camel-mime-part.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index bdb36f6748..39cdbe5cba 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -535,6 +535,8 @@ camel_mime_part_get_content_object(CamelMimePart *mime_part)
static void
_set_content_object(CamelMimePart *mime_part, CamelDataWrapper *content)
{
+ GMimeContentField *object_content_field;
+
CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::set_content_object\n");
if (mime_part->content) {
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_content_object unreferencing old content object\n");
@@ -542,8 +544,10 @@ _set_content_object(CamelMimePart *mime_part, CamelDataWrapper *content)
}
gtk_object_ref (GTK_OBJECT (content));
mime_part->content = content;
- if (mime_part->content_type) gmime_content_field_free (mime_part->content_type);
- mime_part->content_type = camel_data_wrapper_get_mime_type_field (content);
+ object_content_field = camel_data_wrapper_get_mime_type_field (content);
+ if (mime_part->content_type && (mime_part->content_type != object_content_field))
+ gmime_content_field_free (mime_part->content_type);
+ mime_part->content_type = object_content_field;
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::set_content_object\n");
}
@@ -620,7 +624,7 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
write_header_table_to_stream (stream, mp->headers);
CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-type\n");
- gmime_content_field_write_to_stream(mp->content_type, stream);
+ gmime_content_field_write_to_stream (mp->content_type, stream);
camel_stream_write_string(stream,"\n");
_write_content_to_stream (mp, stream);
@@ -753,6 +757,7 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream parsing content\n");
content_type = camel_mime_part_get_content_type (mime_part);
mime_type = gmime_content_field_get_mime_type (content_type);
+ printf ("Content-Type address = %p\n", content_type);
if (!mime_type) {
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream content type field not found "
"using default \"text/plain\"\n");
@@ -760,9 +765,11 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
camel_mime_part_set_content_type (mime_part, mime_type);
}
content_object_type = data_wrapper_repository_get_data_wrapper_type (mime_type);
+
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream content type object type used: %s\n", gtk_type_name (content_object_type));
g_free (mime_type);
content_object = CAMEL_DATA_WRAPPER (gtk_type_new (content_object_type));
+ camel_data_wrapper_set_mime_type_field (content_object, camel_mime_part_get_content_type (mime_part));
camel_mime_part_set_content_object (mime_part, content_object);
camel_data_wrapper_construct_from_stream (content_object, stream);
@@ -810,3 +817,4 @@ camel_mime_part_set_text (CamelMimePart *camel_mime_part, gchar *text)
CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Leaving camel_mime_part_set_text\n");
}
+