aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>2000-02-22 08:10:22 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-02-22 08:10:22 +0800
commitd28c85dd04ba77b30232c8c5dc1c5db3d4c14753 (patch)
tree19698fb20e5eb5ddf398bf9ffe023e30eea563d7 /camel/camel-mime-part.c
parent3b3a08b1de601f1ec9fd0d8f210b0ec49bfba1a1 (diff)
downloadgsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar.gz
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar.bz2
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar.lz
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar.xz
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.tar.zst
gsoc2013-evolution-d28c85dd04ba77b30232c8c5dc1c5db3d4c14753.zip
A lot of changes in the way the parsing works. I am too lazy
to find all the changes. Important notice, I added uggly hacks to camel-formatter.c and message-browser so that I could test b64 decoding. Saving streams works. Have to implement qp now. svn path=/trunk/; revision=1893
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r--camel/camel-mime-part.c54
1 files changed, 50 insertions, 4 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 082f62fab0..bfd511ca13 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -42,6 +42,7 @@
#include "camel-mime-part-utils.h"
#include "gmime-base64.h"
#include "camel-seekable-substream.h"
+#include "camel-stream-b64.h"
typedef enum {
@@ -606,13 +607,31 @@ _get_content_object (CamelMedium *medium)
{
CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
CamelStream *stream;
+ CamelStream *decoded_stream;
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object entering\n");
if (!medium->content ) {
stream = mime_part->content_input_stream;
+ decoded_stream = stream;
+
+ switch (mime_part->encoding) {
- camel_mime_part_construct_content_from_stream (mime_part, stream);
+ case CAMEL_MIME_PART_ENCODING_DEFAULT:
+ case CAMEL_MIME_PART_ENCODING_7BIT:
+ case CAMEL_MIME_PART_ENCODING_8BIT:
+ case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
+ break;
+
+ case CAMEL_MIME_PART_ENCODING_BASE64:
+ decoded_stream = camel_stream_b64_new_with_input_stream (stream);
+ camel_stream_b64_set_mode (CAMEL_STREAM_B64 (decoded_stream),
+ CAMEL_STREAM_B64_DECODER);
+ break;
+ }
+
+
+ camel_mime_part_construct_content_from_stream (mime_part, decoded_stream);
} else {
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer "
@@ -663,7 +682,7 @@ _write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
g_warning ("Class `%s' does not implement `get_stream'",
gtk_type_name (GTK_OBJECT (content)->klass->type));
}
- gmime_encode_base64 (wrapper_stream, stream);
+ gmime_encode_base64_to_stream (wrapper_stream, stream);
break;
default:
g_warning ("Encoding type `%s' not supported.",
@@ -848,11 +867,37 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
static CamelStream *
_get_output_stream (CamelDataWrapper *data_wrapper)
{
-
+ CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper);
+ CamelStream *input_stream;
+ CamelStream *output_stream;
+ /* ** FIXME : bogus bogus bogus - test test test */
+
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_output_stream leaving\n");
- return camel_data_wrapper_get_input_stream (data_wrapper);
+ input_stream = camel_data_wrapper_get_input_stream (data_wrapper);
+
+ if (input_stream == NULL)
+ return NULL;
+
+ switch (mime_part->encoding) {
+
+ case CAMEL_MIME_PART_ENCODING_DEFAULT:
+ case CAMEL_MIME_PART_ENCODING_7BIT:
+ case CAMEL_MIME_PART_ENCODING_8BIT:
+ return input_stream;
+
+ case CAMEL_MIME_PART_ENCODING_BASE64:
+ output_stream = camel_stream_b64_new_with_input_stream (input_stream);
+ camel_stream_b64_set_mode (CAMEL_STREAM_B64 (output_stream),
+ CAMEL_STREAM_B64_ENCODER);
+ return output_stream;
+
+ case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
+ return input_stream;
+ }
+
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_output_stream leaving\n");
+ return NULL;
}
@@ -874,6 +919,7 @@ camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
}
+
/* FIXME I am not sure this is the correct way to do this. */
CamelMimePartEncodingType
camel_mime_part_encoding_from_string (const gchar *string)