From c2e29d97bf36012f4b2ee4d827994bd0d032560c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 17 Dec 2001 02:51:00 +0000 Subject: Reverted my previous changes here since it doesn't actually work afterall. 2001-12-16 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (get_content): Reverted my previous changes here since it doesn't actually work afterall. * providers/imap/camel-imap-wrapper.c (imap_wrapper_hydrate): Update to do uudecoding when appropriate. svn path=/trunk/; revision=15098 --- camel/providers/imap/camel-imap-folder.c | 11 ++------- camel/providers/imap/camel-imap-wrapper.c | 41 ++++++++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 492026dc07..e9681797ad 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -1407,19 +1407,12 @@ get_content (CamelImapFolder *imap_folder, const char *uid, if (header_content_type_is (ci->type, "multipart", "*")) { CamelMultipart *body_mp; int speclen, num; - char *type; body_mp = camel_multipart_new (); camel_data_wrapper_set_mime_type_field ( CAMEL_DATA_WRAPPER (body_mp), ci->type); - /* try and set the original boundary rather than generating a new one... */ - camel_multipart_set_boundary (body_mp, header_content_type_param (ci->type, "boundary")); - - /* looks kinda nasty but this is how ya gotta do it... */ - type = header_content_type_format (ci->type); - camel_mime_part_set_content_type (CAMEL_MIME_PART (body_mp), type); - g_free (type); + camel_multipart_set_boundary (body_mp, NULL); speclen = strlen (part_spec); child_spec = g_malloc (speclen + 15); @@ -2002,7 +1995,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid, CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock); CAMEL_IMAP_STORE_UNLOCK (store, command_lock); return stream; - } + } if (camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) { camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, diff --git a/camel/providers/imap/camel-imap-wrapper.c b/camel/providers/imap/camel-imap-wrapper.c index 53646bb201..8559203c16 100644 --- a/camel/providers/imap/camel-imap-wrapper.c +++ b/camel/providers/imap/camel-imap-wrapper.c @@ -113,31 +113,38 @@ imap_wrapper_hydrate (CamelImapWrapper *imap_wrapper, CamelStream *stream) CamelStreamFilter *filterstream; CamelMimeFilter *filter; CamelContentType *ct; - + filterstream = camel_stream_filter_new_with_stream (stream); - - if (camel_mime_part_get_encoding (imap_wrapper->part) == - CAMEL_MIME_PART_ENCODING_BASE64) { + + /* FIXME: lame. We already have code to do all this shit in camel-mime-part-utils.c */ + switch (camel_mime_part_get_encoding (imap_wrapper->part)) { + case CAMEL_MIME_PART_ENCODING_BASE64: filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type (CAMEL_MIME_FILTER_BASIC_BASE64_DEC); camel_stream_filter_add (filterstream, filter); - } else if (camel_mime_part_get_encoding (imap_wrapper->part) == - CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE) { + break; + case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE: filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type (CAMEL_MIME_FILTER_BASIC_QP_DEC); camel_stream_filter_add (filterstream, filter); - } else + break; + case CAMEL_MIME_PART_ENCODING_UUENCODE: + filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type (CAMEL_MIME_FILTER_BASIC_UU_DEC); + camel_stream_filter_add (filterstream, filter); + break; + default: filter = NULL; - + } + ct = camel_mime_part_get_content_type (imap_wrapper->part); if (header_content_type_is (ct, "text", "*")) { const char *charset; - - /* If we just did B64/QP, need to also do CRLF->LF */ + + /* If we just did B64/QP/UU, need to also do CRLF->LF */ if (filter) { filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); camel_stream_filter_add (filterstream, filter); } - + charset = header_content_type_param (ct, "charset"); if (charset && !(strcasecmp (charset, "us-ascii") == 0 || strcasecmp (charset, "utf-8") == 0)) { @@ -146,10 +153,10 @@ imap_wrapper_hydrate (CamelImapWrapper *imap_wrapper, CamelStream *stream) camel_stream_filter_add (filterstream, filter); } } - + data_wrapper->stream = CAMEL_STREAM (filterstream); data_wrapper->offline = FALSE; - + camel_object_unref (CAMEL_OBJECT (imap_wrapper->folder)); imap_wrapper->folder = NULL; g_free (imap_wrapper->uid); @@ -163,11 +170,11 @@ static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (data_wrapper); - + CAMEL_IMAP_WRAPPER_LOCK (imap_wrapper, lock); if (data_wrapper->offline) { CamelStream *datastream; - + datastream = camel_imap_folder_fetch_data ( imap_wrapper->folder, imap_wrapper->uid, imap_wrapper->part_spec, FALSE, NULL); @@ -176,12 +183,12 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) errno = ENETUNREACH; return -1; } - + imap_wrapper_hydrate (imap_wrapper, datastream); camel_object_unref (CAMEL_OBJECT (datastream)); } CAMEL_IMAP_WRAPPER_UNLOCK (imap_wrapper, lock); - + return parent_class->write_to_stream (data_wrapper, stream); } -- cgit v1.2.3