aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-filter-basic.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-06 15:19:41 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-06 15:19:41 +0800
commit9ab12dd363d2478adb151ee0b1795f251b82f127 (patch)
treef324b062e2d1d3640f25920edd99d3963ac8b536 /camel/camel-mime-filter-basic.c
parent2a92bbba53368e4cf2509d40dc044436eb59e3fd (diff)
downloadgsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar.gz
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar.bz2
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar.lz
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar.xz
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.tar.zst
gsoc2013-evolution-9ab12dd363d2478adb151ee0b1795f251b82f127.zip
Implemented uuencoding and decoding. (complete): Implemented uuencoding
2001-10-06 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-filter-basic.c (filter): Implemented uuencoding and decoding. (complete): Implemented uuencoding and decoding. * camel-mime-utils.c (uuencode_close): New function to flush the uu encoder. (uuencode_step): New function to uuencode a block of data. svn path=/trunk/; revision=13476
Diffstat (limited to 'camel/camel-mime-filter-basic.c')
-rw-r--r--camel/camel-mime-filter-basic.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c
index 056110695c..63db68f9d9 100644
--- a/camel/camel-mime-filter-basic.c
+++ b/camel/camel-mime-filter-basic.c
@@ -108,6 +108,13 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
newlen = quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len*4+4);
break;
+ case CAMEL_MIME_FILTER_BASIC_UU_ENC:
+ /* won't go to more than 2 * (x + 2) + 62 */
+ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
+ newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state,
+ &f->save, &f->uulen);
+ g_assert (newlen <= (len + 2) * 2 + 62);
+ break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len, FALSE);
@@ -120,6 +127,11 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len);
break;
+ case CAMEL_MIME_FILTER_BASIC_UU_DEC:
+ /* output can't possibly exceed the input size */
+ camel_mime_filter_set_size (mf, len, FALSE);
+ newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen);
+ break;
default:
g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
goto donothing;
@@ -156,6 +168,11 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
newlen = quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len*4+4);
break;
+ case CAMEL_MIME_FILTER_BASIC_UU_ENC:
+ /* won't go to more than 2 * (x + 2) + 62 */
+ camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
+ newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save, &f->uulen);
+ g_assert (newlen <= (len + 2) * 2 + 62);
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len+3, FALSE);
@@ -168,6 +185,11 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
newlen = quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
g_assert(newlen <= len);
break;
+ case CAMEL_MIME_FILTER_BASIC_UU_DEC:
+ /* output can't possibly exceed the input size */
+ camel_mime_filter_set_size (mf, len, FALSE);
+ newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen);
+ break;
default:
g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
goto donothing;
@@ -208,6 +230,8 @@ camel_mime_filter_basic_new_type(CamelMimeFilterBasicType type)
case CAMEL_MIME_FILTER_BASIC_QP_ENC:
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
case CAMEL_MIME_FILTER_BASIC_QP_DEC:
+ case CAMEL_MIME_FILTER_BASIC_UU_ENC:
+ case CAMEL_MIME_FILTER_BASIC_UU_DEC:
new = camel_mime_filter_basic_new();
new->type = type;
break;