diff options
author | bertrand <Bertrand.Guiheneuf@inria.fr> | 1999-06-28 22:36:11 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-06-28 22:36:11 +0800 |
commit | 817f237398296dbdafc091d51a6fed2053a9c1c1 (patch) | |
tree | e5b08c4a07a052f67d286852b96daaaddb3c0840 /camel | |
parent | 0e4983d6b9e0450741ffa8d7c7b0257d5fbbf3a3 (diff) | |
download | gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar.gz gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar.bz2 gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar.lz gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar.xz gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.tar.zst gsoc2013-evolution-817f237398296dbdafc091d51a6fed2053a9c1c1.zip |
new field (content_type) and associated methods. (camel_mime_part_init):
1999-06-28 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-mime-part.c:
new field (content_type) and associated methods.
(camel_mime_part_init): initialize content_type field.
(_parse_header_pair): now set content_type MimePart field
instead of using DataWrapper Mime typing facility.
1999-06-28 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-data-wrapper.h:
s/content_type/mime_type/
1
svn path=/trunk/; revision=1002
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-data-wrapper.c | 28 | ||||
-rw-r--r-- | camel/camel-data-wrapper.h | 11 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 81 | ||||
-rw-r--r-- | camel/camel-mime-part.h | 5 |
4 files changed, 81 insertions, 44 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index f885e8a0a6..38d91b13e9 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -33,8 +33,8 @@ static GtkObjectClass *parent_class=NULL; static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, guint size); static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -static void _set_content_type (CamelDataWrapper *data_wrapper, GString *content_type); -static GString *_get_content_type (CamelDataWrapper *data_wrapper); +static void _set_mime_type (CamelDataWrapper *data_wrapper, GString *mime_type); +static GString *_get_mime_type (CamelDataWrapper *data_wrapper); static void camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) @@ -44,8 +44,8 @@ camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) /* virtual method definition */ camel_data_wrapper_class->write_to_stream = _write_to_stream; camel_data_wrapper_class->construct_from_stream = _construct_from_stream; - camel_data_wrapper_class->set_content_type = _set_content_type; - camel_data_wrapper_class->get_content_type = _get_content_type; + camel_data_wrapper_class->set_mime_type = _set_mime_type; + camel_data_wrapper_class->get_mime_type = _get_mime_type; /* virtual method overload */ } @@ -59,7 +59,7 @@ camel_data_wrapper_init (gpointer object, gpointer klass) { CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object); - camel_data_wrapper->content_type = gmime_content_field_new (NULL, NULL); + camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL); } @@ -147,29 +147,29 @@ camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelS static void -_set_content_type (CamelDataWrapper *data_wrapper, GString *content_type) +_set_mime_type (CamelDataWrapper *data_wrapper, GString *mime_type) { - g_assert (content_type); - gmime_content_field_construct_from_string (data_wrapper->content_type, content_type); + g_assert (mime_type); + gmime_content_field_construct_from_string (data_wrapper->mime_type, mime_type); } void -camel_data_wrapper_set_content_type (CamelDataWrapper *data_wrapper, GString *content_type) +camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, GString *mime_type) { - CDW_CLASS(data_wrapper)->set_content_type (data_wrapper, content_type); + CDW_CLASS(data_wrapper)->set_mime_type (data_wrapper, mime_type); } static GString * -_get_content_type (CamelDataWrapper *data_wrapper) +_get_mime_type (CamelDataWrapper *data_wrapper) { GString *mime_type; - mime_type = gmime_content_field_get_mime_type (data_wrapper->content_type); + mime_type = gmime_content_field_get_mime_type (data_wrapper->mime_type); return mime_type; } static GString * -camel_data_wrapper_get_content_type (CamelDataWrapper *data_wrapper) +camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper) { - return CDW_CLASS(data_wrapper)->get_content_type (data_wrapper); + return CDW_CLASS(data_wrapper)->get_mime_type (data_wrapper); } diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h index a0bb859f3b..d0881ebe6e 100644 --- a/camel/camel-data-wrapper.h +++ b/camel/camel-data-wrapper.h @@ -48,8 +48,7 @@ typedef struct { GtkObject parent_object; - GMimeContentField *content_type; - + GMimeContentField *mime_type; } CamelDataWrapper; @@ -60,8 +59,8 @@ typedef struct { /* Virtual methods */ void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream); void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream, guint size); - void (*set_content_type) (CamelDataWrapper *data_wrapper, GString *content_type); - GString * (*get_content_type) (CamelDataWrapper *data_wrapper); + void (*set_mime_type) (CamelDataWrapper *data_wrapper, GString *content_type); + GString * (*get_mime_type) (CamelDataWrapper *data_wrapper); } CamelDataWrapperClass; @@ -75,8 +74,8 @@ GtkType camel_data_wrapper_get_type (void); void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, guint size); -void camel_data_wrapper_set_content_type (CamelDataWrapper *data_wrapper, GString *content_type); -static GString *camel_data_wrapper_get_content_type (CamelDataWrapper *data_wrapper); +void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, GString *mime_type); +static GString *camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper); #ifdef __cplusplus } diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 89eb85b35f..5bba86f54a 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -68,6 +68,8 @@ 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); @@ -99,25 +101,28 @@ camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class) _init_header_name_table(); /* virtual method definition */ - camel_mime_part_class->add_header=_add_header; - camel_mime_part_class->remove_header=_remove_header; - camel_mime_part_class->get_header=_get_header; - camel_mime_part_class->set_description=_set_description; - camel_mime_part_class->get_description=_get_description; - camel_mime_part_class->set_disposition=_set_disposition; - camel_mime_part_class->get_disposition=_get_disposition; - camel_mime_part_class->set_filename=_set_filename; - camel_mime_part_class->get_filename=_get_filename; - camel_mime_part_class->set_content_id=_set_content_id; - camel_mime_part_class->get_content_id=_get_content_id; - camel_mime_part_class->set_content_MD5=_set_content_MD5; - camel_mime_part_class->get_content_MD5=_get_content_MD5; - camel_mime_part_class->set_encoding=_set_encoding; - camel_mime_part_class->get_encoding=_get_encoding; - camel_mime_part_class->set_content_languages=_set_content_languages; - camel_mime_part_class->get_content_languages=_get_content_languages; - camel_mime_part_class->set_header_lines=_set_header_lines; - camel_mime_part_class->get_header_lines=_get_header_lines; + camel_mime_part_class->add_header = _add_header; + camel_mime_part_class->remove_header = _remove_header; + camel_mime_part_class->get_header = _get_header; + camel_mime_part_class->set_description = _set_description; + camel_mime_part_class->get_description = _get_description; + camel_mime_part_class->set_disposition = _set_disposition; + camel_mime_part_class->get_disposition = _get_disposition; + camel_mime_part_class->set_filename = _set_filename; + camel_mime_part_class->get_filename = _get_filename; + camel_mime_part_class->set_content_id = _set_content_id; + camel_mime_part_class->get_content_id = _get_content_id; + camel_mime_part_class->set_content_MD5 =_set_content_MD5; + camel_mime_part_class->get_content_MD5 = _get_content_MD5; + camel_mime_part_class->set_encoding = _set_encoding; + camel_mime_part_class->get_encoding = _get_encoding; + camel_mime_part_class->set_content_languages = _set_content_languages; + camel_mime_part_class->get_content_languages = _get_content_languages; + camel_mime_part_class->set_header_lines =_set_header_lines; + camel_mime_part_class->get_header_lines =_get_header_lines; + camel_mime_part_class->set_content_type = _set_content_type; + camel_mime_part_class->get_content_type = _get_content_type; + camel_mime_part_class->parse_header_pair = _parse_header_pair; camel_mime_part_class->get_content_object = _get_content_object; @@ -133,7 +138,7 @@ 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 = gmime_content_field_new (NULL, NULL); } @@ -478,6 +483,36 @@ camel_mime_part_get_header_lines (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, content_type); +} + +void +camel_mime_part_set_mime_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); + return mime_type; +} + +static GString * +camel_mime_part_get_content_type (CamelMimePart *mime_part) +{ + return CMP_CLASS(mime_part)->get_content_type (mime_part); +} +/*********/ + static CamelDataWrapper * _get_content_object(CamelMimePart *mime_part) @@ -554,7 +589,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(data_wrapper->content_type, stream); + gmime_content_field_write_to_stream(mp->content_type, stream); camel_stream_write_string(stream,"\n"); if (mp->content) camel_data_wrapper_write_to_stream (mp->content, stream); @@ -621,12 +656,12 @@ _parse_header_pair (CamelMimePart *mime_part, GString *header_name, GString *hea header_handled = TRUE; break; - case HEADER_CONTENT_TYPE: /**** * WARNING THIS IS BROKEN * *****/ + case HEADER_CONTENT_TYPE: CAMEL_LOG (FULL_DEBUG, "CamelMimePart::parse_header_pair found HEADER_CONTENT_TYPE: %s\n", header_value->str ); - gmime_content_field_construct_from_string (CAMEL_DATA_WRAPPER(mime_part)->content_type, header_value); + gmime_content_field_construct_from_string (mime_part->content_type, header_value); header_handled = TRUE; break; diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h index eadf65ce68..ad3ce17d2f 100644 --- a/camel/camel-mime-part.h +++ b/camel/camel-mime-part.h @@ -58,7 +58,8 @@ typedef struct GString *encoding; GString *filename; GList *header_lines; - + + GMimeContentField *content_type; CamelDataWrapper *content; /* part real content */ } CamelMimePart; @@ -88,6 +89,8 @@ typedef struct { GList * (*get_content_languages) (CamelMimePart *mime_part); void (*set_header_lines) (CamelMimePart *mime_part, GList *header_lines); GList * (*get_header_lines) (CamelMimePart *mime_part); + void (*set_content_type) (CamelMimePart *mime_part, GString *content_type); + GString * (*get_content_type) (CamelMimePart *mime_part); gboolean (*parse_header_pair) (CamelMimePart *mime_part, GString *header_name, GString *header_value); |