aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-08-31 10:24:49 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-08-31 10:24:49 +0800
commit13c90a81d9b01ee7f19f3ce766c9504d0d02a9be (patch)
treed17050133b871ab08fbc1f4a5c1640cd263b12e9
parent847c27f555cab89444f863326de57abcd8ad9766 (diff)
downloadgsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar.gz
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar.bz2
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar.lz
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar.xz
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.tar.zst
gsoc2013-evolution-13c90a81d9b01ee7f19f3ce766c9504d0d02a9be.zip
Use the proper type checking function to check for text types.
2000-08-31 Not Zed <NotZed@HelixCode.com> * camel-mime-part.c (write_to_stream): Use the proper type checking function to check for text types. (write_to_stream): If we have a charset on a text type that isn't us-ascii or utf-8, then we need to reencode it, so add a filter to do that too. svn path=/trunk/; revision=5131
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-part.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6c587fe801..90672ffc62 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,11 @@
2000-08-31 Not Zed <NotZed@HelixCode.com>
+ * camel-mime-part.c (write_to_stream): Use the proper type
+ checking function to check for text types.
+ (write_to_stream): If we have a charset on a text type that
+ isn't us-ascii or utf-8, then we need to reencode it, so add a
+ filter to do that too.
+
* camel-mime-utils.c (append_latin1): New function - even though
its broken, we'll assume mailers send latin1 headers instead of
us-ascii. We just have to encode high chars into utf-8.
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index f9519df5e4..ae33f5c8ce 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -517,11 +517,23 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
if (filter) {
filter_stream = camel_stream_filter_new_with_stream(stream);
- if (!strcasecmp(mp->content_type->type, "text")) {
+ if (gmime_content_field_is_type(mp->content_type, "text", "*")) {
CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
+ char *charset;
+
camel_stream_filter_add(filter_stream, crlf);
camel_object_unref((CamelObject *)crlf);
+
+ charset = gmime_content_field_get_parameter(mp->content_type, "charset");
+ if (!(charset == NULL || !strcasecmp(charset, "us-ascii") || !strcasecmp(charset, "utf-8"))) {
+ CamelMimeFilter *charenc;
+ charenc = camel_mime_filter_charset_new("utf-8", charset);
+ camel_stream_filter_add(filter_stream, charenc);
+ /* well some idiot changed the _add function to do its own ref'ing for
+ no decent purpose whatsoever ... */
+ camel_object_unref((CamelObject *)charenc);
+ }
}
camel_stream_filter_add(filter_stream, filter);
camel_object_unref((CamelObject *)filter);