diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-10-18 09:06:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-10-18 09:06:55 +0800 |
commit | 5543f7d8100d762958fde07967ca1b3e0616feb9 (patch) | |
tree | 09a733a62cb77efd8d8d123156c1d1f32a2d29ca /camel/camel-mime-part.c | |
parent | 84aca4e2c840aae8f7cc64ef7979edbeeec2d71c (diff) | |
download | gsoc2013-evolution-5543f7d8100d762958fde07967ca1b3e0616feb9.tar.gz gsoc2013-evolution-5543f7d8100d762958fde07967ca1b3e0616feb9.tar.zst gsoc2013-evolution-5543f7d8100d762958fde07967ca1b3e0616feb9.zip |
Encode the header value. (add_header): Same.
2000-10-17 Jeffrey Stedfast <fejj@helixcode.com>
* camel-mime-part.c (set_header): Encode the header value.
(add_header): Same.
svn path=/trunk/; revision=5970
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r-- | camel/camel-mime-part.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index e829b28834..955a3a7738 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -187,7 +187,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ /* known, the job is done in the parsing routine. If not, */ /* we simply add the header in a raw fashion */ - /* FIXMME: MUST check fields for validity before adding them! */ + /* FIXME: MUST check fields for validity before adding them! */ header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name); switch (header_type) { @@ -222,39 +222,47 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ return TRUE; } +/* Note: It is my understanding that we need to encode the values here as they are + not being encoded at the header_raw_* level. */ static void set_header (CamelMedium *medium, const char *header_name, const void *header_value) { - CamelMimePart *part = (CamelMimePart *)medium; - - process_header(medium, header_name, header_value); - header_raw_replace(&part->headers, header_name, header_value, -1); + CamelMimePart *part = CAMEL_MIME_PART (medium); + char *encoded_value = header_encode_string (header_value); + + process_header (medium, header_name, encoded_value); + header_raw_replace (&part->headers, header_name, encoded_value, -1); + + g_free (encoded_value); } static void add_header (CamelMedium *medium, const char *header_name, const void *header_value) { - CamelMimePart *part = (CamelMimePart *)medium; - + CamelMimePart *part = CAMEL_MIME_PART (medium); + char *encoded_value = header_encode_string (header_value); + /* Try to parse the header pair. If it corresponds to something */ /* known, the job is done in the parsing routine. If not, */ /* we simply add the header in a raw fashion */ - /* FIXMME: MUST check fields for validity before adding them! */ + /* FIXME: MUST check fields for validity before adding them! */ /* If it was one of the headers we handled, it must be unique, set it instead of add */ - if (process_header(medium, header_name, header_value)) - header_raw_replace(&part->headers, header_name, header_value, -1); + if (process_header (medium, header_name, encoded_value)) + header_raw_replace (&part->headers, header_name, encoded_value, -1); else - header_raw_append(&part->headers, header_name, header_value, -1); + header_raw_append (&part->headers, header_name, encoded_value, -1); + + g_free (encoded_value); } static void remove_header (CamelMedium *medium, const char *header_name) { CamelMimePart *part = (CamelMimePart *)medium; - + process_header(medium, header_name, NULL); header_raw_remove(&part->headers, header_name); } |