aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/providers/imap/camel-imap-folder.c11
-rw-r--r--camel/providers/imap/camel-imap-wrapper.c41
3 files changed, 34 insertions, 26 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f1da9a7e48..c3c40749ad 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,13 @@
2001-12-16 Jeffrey Stedfast <fejj@ximian.com>
+ * 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.
+
+2001-12-16 Jeffrey Stedfast <fejj@ximian.com>
+
* providers/imap/camel-imap-folder.c (get_content): Try to use the
original boundary so luis will stop bugging me about "data
corruption". Also preserve other params in the multipart
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);
}