aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-wrapper.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-12-17 10:51:00 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-12-17 10:51:00 +0800
commitc2e29d97bf36012f4b2ee4d827994bd0d032560c (patch)
treed034c31ae0309c244b10d3f482cb299bfc59c26b /camel/providers/imap/camel-imap-wrapper.c
parentc2c7bc59520288e69939727fd768d848328bdcad (diff)
downloadgsoc2013-evolution-c2e29d97bf36012f4b2ee4d827994bd0d032560c.tar.gz
gsoc2013-evolution-c2e29d97bf36012f4b2ee4d827994bd0d032560c.tar.zst
gsoc2013-evolution-c2e29d97bf36012f4b2ee4d827994bd0d032560c.zip
Reverted my previous changes here since it doesn't actually work afterall.
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. svn path=/trunk/; revision=15098
Diffstat (limited to 'camel/providers/imap/camel-imap-wrapper.c')
-rw-r--r--camel/providers/imap/camel-imap-wrapper.c41
1 files changed, 24 insertions, 17 deletions
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);
}