From 7f81757d52326126f88e898241dc40c1668f5164 Mon Sep 17 00:00:00 2001 From: bertrand Date: Tue, 22 Jun 1999 16:12:27 +0000 Subject: moved all the content-type stuff here. (camel_data_wrapper_init): 1999-06-22 bertrand * camel/camel-data-wrapper.c (_get_content_type): moved all the content-type stuff here. (camel_data_wrapper_init): initialize the instance content-type field. * camel/camel-mime-part.c (_parse_header_pair): parse Content-Type stuff in header. (_write_to_stream): write the content type stuff to the stream. svn path=/trunk/; revision=985 --- camel/camel-mime-part.c | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'camel/camel-mime-part.c') diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 489e6d0d27..8e187a8eac 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -68,8 +68,6 @@ static void _set_content_languages (CamelMimePart *mime_part, GList *content_lan static GList *_get_content_languages (CamelMimePart *mime_part); static void _set_header_lines (CamelMimePart *mime_part, GList *header_lines); static GList *_get_header_lines (CamelMimePart *mime_part); -static void _set_content_type (CamelMimePart *mime_part, GString *content_type); -static GString *_get_content_type (CamelMimePart *mime_part); static CamelDataWrapper *_get_content_object(CamelMimePart *mime_part); static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); @@ -122,8 +120,6 @@ camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class) camel_mime_part_class->get_header_lines=_get_header_lines; camel_mime_part_class->parse_header_pair = _parse_header_pair; camel_mime_part_class->get_content_object = _get_content_object; - camel_mime_part_class->set_content_type = _set_content_type; - camel_mime_part_class->get_content_type = _get_content_type; @@ -137,7 +133,6 @@ camel_mime_part_init (gpointer object, gpointer klass) CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object); camel_mime_part->headers = g_hash_table_new (g_string_hash, g_string_equal_for_hash); - camel_mime_part->content_type_field = gmime_content_field_new (NULL, NULL); } @@ -497,34 +492,6 @@ camel_mime_part_get_content_object(CamelMimePart *mime_part) } -static void -_set_content_type (CamelMimePart *mime_part, GString *content_type) -{ - g_assert (content_type); - gmime_content_field_construct_from_string (mime_part->content_type_field, content_type); -} - -void -camel_mime_part_set_content_type (CamelMimePart *mime_part, GString *content_type) -{ - CMP_CLASS(mime_part)->set_content_type (mime_part, content_type); -} - -static GString * -_get_content_type (CamelMimePart *mime_part) -{ - GString *mime_type; - - mime_type = gmime_content_field_get_mime_type (mime_part->content_type_field); - return mime_type; -} - -static GString * -camel_mime_part_get_content_type (CamelMimePart *mime_part) -{ - return CMP_CLASS(mime_part)->get_content_type (mime_part); -} - /**********************************************************************/ @@ -570,8 +537,6 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) CAMEL_LOG (FULL_DEBUG, "Entering CamelMimePart::write_to_stream\n"); - CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing content-type\n"); - gmime_content_field_write_to_stream(data_wrapper->content_type, stream); CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing content-disposition\n"); gmime_content_field_write_to_stream(mp->disposition, stream); CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing content-transfer-encoding\n"); @@ -583,9 +548,14 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing content-id\n"); WHPT (stream, "Content-id", mp->content_id); CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing content-languages\n"); - write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages); + write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages,", "); + CAMEL_LOG (FULL_DEBUG, "CamelMimePart::write_to_stream writing other headers\n"); 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(data_wrapper->content_type, stream); + camel_stream_write_string(stream,"\n"); if (mp->content) camel_data_wrapper_write_to_stream (mp->content, stream); @@ -656,7 +626,7 @@ _parse_header_pair (CamelMimePart *mime_part, GString *header_name, GString *hea "CamelMimePart::parse_header_pair found HEADER_CONTENT_TYPE: %s\n", header_value->str ); - /* CMP_CLASS(mime_part)->set_content_MD5 (mime_part, header_value); */ + gmime_content_field_construct_from_string (CAMEL_DATA_WRAPPER(mime_part)->content_type, header_value); header_handled = TRUE; break; -- cgit v1.2.3