gmime r1297 - in trunk: . docs/reference examples gmime mono src tests



Author: fejj
Date: Thu May 29 02:25:42 2008
New Revision: 1297
URL: http://svn.gnome.org/viewvc/gmime?rev=1297&view=rev

Log:
2008-05-28  Jeffrey Stedfast  <fejj novell com>

	* gmime/gmime-encodings.c: New source file containing all the
	basic MIME encoding functions.

	* src/uuencode.c: Updated.

	* src/uudecode.c: Updated.

	* gmime/gmime-parser.c: Updated for GMimeContentEncoding change.

	* gmime/gmime-multipart-signed.c: Updated for GMimeContentEncoding
	change.

	* gmime/gmime-multipart-encrypted.c: Updated for
	GMimeContentEncoding change.

	* gmime/gmime-message-partial.c: Updated for GMimeContentEncoding
	change.

	* gmime/gmime-filter-best.c (g_mime_filter_best_encoding): Updated
	to use the new GMimeContentEncoding enum.

	* gmime/gmime-data-wrapper.c: Updated to use GMimeContentEncoding
	enum.
	(write_to_stream): Drastically simplified using the new
	GMimeFilterBasic API.

	* gmime/gmime-filter-basic.c: Updated to use the new GMimeEncoding
	API.
	(g_mime_filter_basic_new): Renamed and changed the arguments. We
	now just re-use the GMimeContentEncoding enum and a bool to
	declare encode vs decode.

	* gmime/gmime-utils.c (g_mime_references_free): New function to
	simplify bindings.
	(g_mime_utils_best_encoding): Updated to use the new
	GMimeContentEncoding enum.
	(g_mime_utils_base64_encode_close): Moved to gmime-encodings.c
	and renamed to g_mime_encoding_base64_encode_close().
	(g_mime_utils_base64_encode_step): Same.
	(g_mime_utils_base64_decode_step): Same.
	(g_mime_utils_uuencode_close): Same.
	(g_mime_utils_uuencode_step): Same.
	(g_mime_utils_uudecode_step): Same.
	(g_mime_utils_quoted_encode_close): Same.
	(g_mime_utils_quoted_encode_step): Same.
	(g_mime_utils_quoted_decode_step): Same.

	* gmime/gmime-utils.h (GMimePartEncodingType): Removed. This enum
	has been replaced.

	* gmime/gmime-part.c (g_mime_part_set_content_type): Removed,
	GMimeObject already has this functionality.
	(g_mime_part_get_content_type): Same.
	(g_mime_part_set_content_encoding): Renamed from
	g_mime_part_set_encoding() and updated to use the new
	GMimeContentEncoding enum.
	(g_mime_part_get_content_encoding): Renamed from
	g_mime_part_get_encoding() and updated to use the new
	GMimeContentEncoding enum.
	(g_mime_part_encoding_to_string): Removed, equivalent
	functionality has been added to gmime-encodings.c named
	g_mime_content_encoding_to_string().
	(g_mime_part_encoding_from_string): Removed, equivalent
	functionality has been added to gmime-encodings.c named
	g_mime_content_encoding_from_string().
	(write_content): Updated for new GMimeFilterBasic API which helps
	simplify this.



Modified:
   trunk/ChangeLog
   trunk/docs/reference/gmime-sections.txt
   trunk/examples/basic-example.c
   trunk/examples/imap-example.c
   trunk/gmime/Makefile.am
   trunk/gmime/gmime-data-wrapper.c
   trunk/gmime/gmime-data-wrapper.h
   trunk/gmime/gmime-filter-basic.c
   trunk/gmime/gmime-filter-basic.h
   trunk/gmime/gmime-filter-best.c
   trunk/gmime/gmime-filter-best.h
   trunk/gmime/gmime-message-partial.c
   trunk/gmime/gmime-multipart-encrypted.c
   trunk/gmime/gmime-multipart-signed.c
   trunk/gmime/gmime-multipart.c
   trunk/gmime/gmime-parser.c
   trunk/gmime/gmime-part.c
   trunk/gmime/gmime-part.h
   trunk/gmime/gmime-utils.c
   trunk/gmime/gmime-utils.h
   trunk/gmime/gmime.h
   trunk/mono/DataWrapper.custom
   trunk/mono/GMime.metadata
   trunk/mono/gmime-api.raw
   trunk/src/uudecode.c
   trunk/src/uuencode.c
   trunk/tests/test-best.c
   trunk/tests/test-pgpmime.c

Modified: trunk/docs/reference/gmime-sections.txt
==============================================================================
--- trunk/docs/reference/gmime-sections.txt	(original)
+++ trunk/docs/reference/gmime-sections.txt	Thu May 29 02:25:42 2008
@@ -282,8 +282,7 @@
 <SECTION>
 <FILE>gmime-filter-basic</FILE>
 GMimeFilterBasic
-GMimeFilterBasicType
-g_mime_filter_basic_new_type
+g_mime_filter_basic_new
 
 <SUBSECTION Private>
 g_mime_filter_basic_get_type
@@ -674,10 +673,8 @@
 g_mime_part_verify_content_md5
 g_mime_part_set_content_location
 g_mime_part_get_content_location
-g_mime_part_set_encoding
-g_mime_part_get_encoding
-g_mime_part_encoding_to_string
-g_mime_part_encoding_from_string
+g_mime_part_set_content_encoding
+g_mime_part_get_content_encoding
 g_mime_part_set_filename
 g_mime_part_get_filename
 g_mime_part_get_content_object
@@ -858,7 +855,6 @@
 
 <SECTION>
 <FILE>gmime-utils</FILE>
-GMimePartEncodingType
 GMimeReferences
 g_mime_utils_header_decode_date
 g_mime_utils_header_format_date
@@ -869,6 +865,7 @@
 g_mime_references_decode
 g_mime_references_append
 g_mime_references_clear
+g_mime_references_free
 g_mime_utils_header_fold
 g_mime_utils_header_printf
 g_mime_utils_quote_string
@@ -882,25 +879,37 @@
 g_mime_utils_header_encode_phrase
 g_mime_utils_structured_header_fold
 g_mime_utils_unstructured_header_fold
+</SECTION>
+
+<SECTION>
+<FILE>gmime-encodings</FILE>
+GMimeContentEncoding
+g_mime_content_encoding_from_string
+g_mime_content_encoding_to_string
+GMimeEncoding
+g_mime_encoding_init_encode
+g_mime_encoding_init_decode
+g_mime_encoding_reset
+g_mime_encoding_outlen
+g_mime_encoding_step
+g_mime_encoding_flush
 GMIME_BASE64_ENCODE_LEN
-g_mime_utils_base64_decode_step
-g_mime_utils_base64_encode_step
-g_mime_utils_base64_encode_close
+g_mime_encoding_base64_decode_step
+g_mime_encoding_base64_encode_step
+g_mime_encoding_base64_encode_close
 GMIME_UUDECODE_STATE_INIT
 GMIME_UUDECODE_STATE_BEGIN
 GMIME_UUDECODE_STATE_END
 GMIME_UUENCODE_LEN
-g_mime_utils_uudecode_step
-g_mime_utils_uuencode_step
-g_mime_utils_uuencode_close
+g_mime_encoding_uudecode_step
+g_mime_encoding_uuencode_step
+g_mime_encoding_uuencode_close
 GMIME_QP_ENCODE_LEN
-g_mime_utils_quoted_decode_step
-g_mime_utils_quoted_encode_step
-g_mime_utils_quoted_encode_close
+g_mime_encoding_quoted_decode_step
+g_mime_encoding_quoted_encode_step
+g_mime_encoding_quoted_encode_close
 
 <SUBSECTION Private>
-QP_ENCODE_LEN
-BASE64_ENCODE_LEN
 GMIME_UUDECODE_STATE_MASK
 
 </SECTION>
@@ -1029,14 +1038,6 @@
 g_mime_cipher_context_decrypt
 g_mime_cipher_context_import_keys
 g_mime_cipher_context_export_keys
-g_mime_cipher_hash_id
-g_mime_cipher_hash_name
-g_mime_cipher_sign
-g_mime_cipher_verify
-g_mime_cipher_encrypt
-g_mime_cipher_decrypt
-g_mime_cipher_import_keys
-g_mime_cipher_export_keys
 <SUBSECTION>
 g_mime_signer_new
 g_mime_signer_free

Modified: trunk/examples/basic-example.c
==============================================================================
--- trunk/examples/basic-example.c	(original)
+++ trunk/examples/basic-example.c	Thu May 29 02:25:42 2008
@@ -274,9 +274,9 @@
 	
 	/* create the content object - since the stream is not base64
 	   or QP encoded or anything, we can use
-	   GMIME_PART_ENCODING_DEFAULT as the encoding type (_DEFAULT
+	   GMIME_CONTENT_ENCODING_DEFAULT as the encoding type (_DEFAULT
 	   is the same as saying "nothing specified") */
-	content = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
+	content = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
 	g_object_unref (stream);
 	
 	/* set the content object on the new mime part */
@@ -284,7 +284,7 @@
 	g_object_unref (content);
 	
 	/* if we want, we can tell GMime that the content should be base64 encoded when written to disk... */
-	g_mime_part_set_encoding (mime_part, GMIME_PART_ENCODING_BASE64);
+	g_mime_part_set_content_encoding (mime_part, GMIME_CONTENT_ENCODING_BASE64);
 	
 	/* the "polite" way to modify a mime structure that we didn't
 	   create is to create a new toplevel multipart/mixed part and

Modified: trunk/examples/imap-example.c
==============================================================================
--- trunk/examples/imap-example.c	(original)
+++ trunk/examples/imap-example.c	Thu May 29 02:25:42 2008
@@ -209,22 +209,22 @@
 		}
 		
 		switch (GMIME_PART (part)->encoding) {
-		case GMIME_PART_ENCODING_7BIT:
+		case GMIME_CONTENT_ENCODING_7BIT:
 			fputs ("\"7bit\"", fp);
 			break;
-		case GMIME_PART_ENCODING_8BIT:
+		case GMIME_CONTENT_ENCODING_8BIT:
 			fputs ("\"8bit\"", fp);
 			break;
-		case GMIME_PART_ENCODING_BINARY:
+		case GMIME_CONTENT_ENCODING_BINARY:
 			fputs ("\"binary\"", fp);
 			break;
-		case GMIME_PART_ENCODING_BASE64:
+		case GMIME_CONTENT_ENCODING_BASE64:
 			fputs ("\"base64\"", fp);
 			break;
-		case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
+		case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
 			fputs ("\"quoted-printable\"", fp);
 			break;
-		case GMIME_PART_ENCODING_UUENCODE:
+		case GMIME_CONTENT_ENCODING_UUENCODE:
 			fputs ("\"x-uuencode\"", fp);
 			break;
 		default:

Modified: trunk/gmime/Makefile.am
==============================================================================
--- trunk/gmime/Makefile.am	(original)
+++ trunk/gmime/Makefile.am	Thu May 29 02:25:42 2008
@@ -30,6 +30,7 @@
 	gmime-content-type.c		\
 	gmime-data-wrapper.c		\
 	gmime-disposition.c		\
+	gmime-encodings.c		\
 	gmime-filter.c			\
 	gmime-filter-basic.c		\
 	gmime-filter-best.c		\
@@ -79,6 +80,7 @@
 	gmime-content-type.h		\
 	gmime-data-wrapper.h		\
 	gmime-disposition.h		\
+	gmime-encodings.h		\
 	gmime-error.h			\
 	gmime-filter.h			\
 	gmime-filter-basic.h		\

Modified: trunk/gmime/gmime-data-wrapper.c
==============================================================================
--- trunk/gmime/gmime-data-wrapper.c	(original)
+++ trunk/gmime/gmime-data-wrapper.c	Thu May 29 02:25:42 2008
@@ -91,7 +91,7 @@
 static void
 g_mime_data_wrapper_init (GMimeDataWrapper *wrapper, GMimeDataWrapperClass *klass)
 {
-	wrapper->encoding = GMIME_PART_ENCODING_DEFAULT;
+	wrapper->encoding = GMIME_CONTENT_ENCODING_DEFAULT;
 	wrapper->stream = NULL;
 }
 
@@ -126,14 +126,14 @@
  * @stream: stream
  * @encoding: stream's encoding
  *
- * Creates a new GMimeDataWrapper object around @stream.
+ * Creates a new #GMimeDataWrapper object around @stream.
  *
  * Returns a data wrapper around @stream. Since the wrapper owns its
  * own reference on the stream, caller is responsible for unrefing
  * its own copy.
  **/
 GMimeDataWrapper *
-g_mime_data_wrapper_new_with_stream (GMimeStream *stream, GMimePartEncodingType encoding)
+g_mime_data_wrapper_new_with_stream (GMimeStream *stream, GMimeContentEncoding encoding)
 {
 	GMimeDataWrapper *wrapper;
 	
@@ -142,6 +142,7 @@
 	wrapper = g_mime_data_wrapper_new ();
 	wrapper->encoding = encoding;
 	wrapper->stream = stream;
+	
 	if (stream)
 		g_object_ref (stream);
 	
@@ -208,7 +209,7 @@
  * Sets the encoding type of the internal stream.
  **/
 void
-g_mime_data_wrapper_set_encoding (GMimeDataWrapper *wrapper, GMimePartEncodingType encoding)
+g_mime_data_wrapper_set_encoding (GMimeDataWrapper *wrapper, GMimeContentEncoding encoding)
 {
 	g_return_if_fail (GMIME_IS_DATA_WRAPPER (wrapper));
 	
@@ -224,10 +225,10 @@
  *
  * Returns the encoding type of the internal stream.
  **/
-GMimePartEncodingType
+GMimeContentEncoding
 g_mime_data_wrapper_get_encoding (GMimeDataWrapper *wrapper)
 {
-	g_return_val_if_fail (GMIME_IS_DATA_WRAPPER (wrapper), GMIME_PART_ENCODING_DEFAULT);
+	g_return_val_if_fail (GMIME_IS_DATA_WRAPPER (wrapper), GMIME_CONTENT_ENCODING_DEFAULT);
 	
 	return wrapper->encoding;
 }
@@ -242,24 +243,18 @@
 	
 	g_mime_stream_reset (wrapper->stream);
 	
-	filtered_stream = g_mime_stream_filter_new_with_stream (wrapper->stream);
 	switch (wrapper->encoding) {
-	case GMIME_PART_ENCODING_BASE64:
-		filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_BASE64_DEC);
-		g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
-		g_object_unref (filter);
-		break;
-	case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
-		filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_QP_DEC);
-		g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
-		g_object_unref (filter);
-		break;
-	case GMIME_PART_ENCODING_UUENCODE:
-		filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC);
+	case GMIME_CONTENT_ENCODING_BASE64:
+	case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
+	case GMIME_CONTENT_ENCODING_UUENCODE:
+		filter = g_mime_filter_basic_new (wrapper->encoding, FALSE);
+		filtered_stream = g_mime_stream_filter_new_with_stream (wrapper->stream);
 		g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
 		g_object_unref (filter);
 		break;
 	default:
+		filtered_stream = wrapper->stream;
+		g_object_ref (wrapper->stream);
 		break;
 	}
 	

Modified: trunk/gmime/gmime-data-wrapper.h
==============================================================================
--- trunk/gmime/gmime-data-wrapper.h	(original)
+++ trunk/gmime/gmime-data-wrapper.h	Thu May 29 02:25:42 2008
@@ -26,6 +26,7 @@
 #include <glib-object.h>
 
 #include <gmime/gmime-content-type.h>
+#include <gmime/gmime-encodings.h>
 #include <gmime/gmime-stream.h>
 #include <gmime/gmime-utils.h>
 
@@ -44,7 +45,7 @@
 struct _GMimeDataWrapper {
 	GObject parent_object;
 	
-	GMimePartEncodingType encoding;
+	GMimeContentEncoding encoding;
 	GMimeStream *stream;
 };
 
@@ -58,13 +59,13 @@
 GType g_mime_data_wrapper_get_type (void);
 
 GMimeDataWrapper *g_mime_data_wrapper_new (void);
-GMimeDataWrapper *g_mime_data_wrapper_new_with_stream (GMimeStream *stream, GMimePartEncodingType encoding);
+GMimeDataWrapper *g_mime_data_wrapper_new_with_stream (GMimeStream *stream, GMimeContentEncoding encoding);
 
 void g_mime_data_wrapper_set_stream (GMimeDataWrapper *wrapper, GMimeStream *stream);
 GMimeStream *g_mime_data_wrapper_get_stream (GMimeDataWrapper *wrapper);
 
-void g_mime_data_wrapper_set_encoding (GMimeDataWrapper *wrapper, GMimePartEncodingType encoding);
-GMimePartEncodingType g_mime_data_wrapper_get_encoding (GMimeDataWrapper *wrapper);
+void g_mime_data_wrapper_set_encoding (GMimeDataWrapper *wrapper, GMimeContentEncoding encoding);
+GMimeContentEncoding g_mime_data_wrapper_get_encoding (GMimeDataWrapper *wrapper);
 
 ssize_t g_mime_data_wrapper_write_to_stream (GMimeDataWrapper *wrapper, GMimeStream *stream);
 

Modified: trunk/gmime/gmime-filter-basic.c
==============================================================================
--- trunk/gmime/gmime-filter-basic.c	(original)
+++ trunk/gmime/gmime-filter-basic.c	Thu May 29 02:25:42 2008
@@ -99,9 +99,7 @@
 static void
 g_mime_filter_basic_init (GMimeFilterBasic *filter, GMimeFilterBasicClass *klass)
 {
-	filter->type = 0;
-	filter->state = 0;
-	filter->save = 0;
+	
 }
 
 static void
@@ -115,66 +113,28 @@
 filter_copy (GMimeFilter *filter)
 {
 	GMimeFilterBasic *basic = (GMimeFilterBasic *) filter;
+	GMimeEncoding *encoder = &basic->encoder;
 	
-	return g_mime_filter_basic_new_type (basic->type);
+	return g_mime_filter_basic_new (encoder->encoding, encoder->encode);
 }
 
 /* here we do all of the basic mime filtering */
 static void
-filter_filter (GMimeFilter *filter, char *in, size_t len, size_t prespace,
-	       char **out, size_t *outlen, size_t *outprespace)
+filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
+	       char **outbuf, size_t *outlen, size_t *outprespace)
 {
 	GMimeFilterBasic *basic = (GMimeFilterBasic *) filter;
-	const unsigned char *inbuf;
-	unsigned char *outbuf;
-	size_t newlen = 0;
-	
-	switch (basic->type) {
-	case GMIME_FILTER_BASIC_BASE64_ENC:
-		g_mime_filter_set_size (filter, GMIME_BASE64_ENCODE_LEN (len), FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_base64_encode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= GMIME_BASE64_ENCODE_LEN (len));
-		break;
-	case GMIME_FILTER_BASIC_QP_ENC:
-		g_mime_filter_set_size (filter, GMIME_QP_ENCODE_LEN (len), FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_quoted_encode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= GMIME_QP_ENCODE_LEN (len));
-		break;
-	case GMIME_FILTER_BASIC_UU_ENC:
-		g_mime_filter_set_size (filter, GMIME_UUENCODE_LEN (len), FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_uuencode_step (inbuf, len, outbuf, basic->uubuf, &basic->state,
-						     &basic->save);
-		g_assert (newlen <= GMIME_UUENCODE_LEN (len));
-		break;
-	case GMIME_FILTER_BASIC_BASE64_DEC:
-		/* output can't possibly exceed the input size */
-		g_mime_filter_set_size (filter, len + 3, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_base64_decode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len + 3);
-		break;
-	case GMIME_FILTER_BASIC_QP_DEC:
-		/* output can't possibly exceed the input size */
-		g_mime_filter_set_size (filter, len + 2, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_quoted_decode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len + 2);
-		break;
-	case GMIME_FILTER_BASIC_UU_DEC:
-		if (!(basic->state & GMIME_UUDECODE_STATE_BEGIN)) {
+	GMimeEncoding *encoder = &basic->encoder;
+	size_t nwritten = 0;
+	size_t len;
+	
+	if (!encoder->encode && encoder->encoding == GMIME_CONTENT_ENCODING_UUENCODE) {
+		if (!(encoder->state & GMIME_UUDECODE_STATE_BEGIN)) {
 			register char *inptr, *inend;
 			size_t left;
 			
-			inptr = in;
-			inend = inptr + len;
+			inend = inbuf + inlen;
+			inptr = inbuf;
 			
 			while (inptr < inend) {
 				left = inend - inptr;
@@ -183,15 +143,18 @@
 						g_mime_filter_backup (filter, inptr, left);
 					break;
 				} else if (!strncmp (inptr, "begin ", 6)) {
-					for (in = inptr; inptr < inend && *inptr != '\n'; inptr++);
+					inbuf = inptr;
+					while (inptr < inend && *inptr != '\n')
+						inptr++;
+					
 					if (inptr < inend) {
 						inptr++;
-						basic->state |= GMIME_UUDECODE_STATE_BEGIN;
+						encoder->state |= GMIME_UUDECODE_STATE_BEGIN;
 						/* we can start uudecoding... */
-						in = inptr;
-						len = inend - in;
+						inlen = inend - inptr;
+						inbuf = inptr;
 					} else {
-						g_mime_filter_backup (filter, in, left);
+						g_mime_filter_backup (filter, inbuf, left);
 					}
 					break;
 				}
@@ -205,92 +168,57 @@
 			}
 		}
 		
-		if ((basic->state & GMIME_UUDECODE_STATE_BEGIN) && !(basic->state & GMIME_UUDECODE_STATE_END)) {
-			/* "begin <mode> <filename>\n" has been found, so we can now start decoding */
-			g_mime_filter_set_size (filter, len + 3, FALSE);
-			outbuf = (unsigned char *) filter->outbuf;
-			inbuf = (const unsigned char *) in;
-			newlen = g_mime_utils_uudecode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-			g_assert (newlen <= len + 3);
-		} else {
-			newlen = 0;
+		switch (encoder->state & GMIME_UUDECODE_STATE_MASK) {
+		case GMIME_UUDECODE_STATE_BEGIN:
+			/* "begin <mode> <filename>\n" has been found and not yet seen the end */
+			break;
+		default:
+			/* either we haven't seen the begin-line or we've finished decoding */
+			goto done;
 		}
-		break;
 	}
 	
-	*out = filter->outbuf;
-	*outlen = newlen;
+	len = g_mime_encoding_outlen (encoder, inlen);
+	g_mime_filter_set_size (filter, len, FALSE);
+	nwritten = g_mime_encoding_step (encoder, inbuf, inlen, filter->outbuf);
+	g_assert (nwritten <= len);
+	
+ done:
 	*outprespace = filter->outpre;
+	*outbuf = filter->outbuf;
+	*outlen = nwritten;
 }
 
 static void
-filter_complete (GMimeFilter *filter, char *in, size_t len, size_t prespace,
-		 char **out, size_t *outlen, size_t *outprespace)
+filter_complete (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
+		 char **outbuf, size_t *outlen, size_t *outprespace)
 {
 	GMimeFilterBasic *basic = (GMimeFilterBasic *) filter;
-	const unsigned char *inbuf;
-	unsigned char *outbuf;
-	size_t newlen = 0;
-	
-	switch (basic->type) {
-	case GMIME_FILTER_BASIC_BASE64_ENC:
-		/* wont go to more than 2x size (overly conservative) */
-		g_mime_filter_set_size (filter, len * 2 + 6, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_base64_encode_close (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len * 2 + 6);
-		break;
-	case GMIME_FILTER_BASIC_QP_ENC:
-		/* len * 4 is definetly more than needed ... */
-		g_mime_filter_set_size (filter, len * 4 + 4, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_quoted_encode_close (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len * 4 + 4);
-		break;
-	case GMIME_FILTER_BASIC_UU_ENC:
-		/* won't go to more than 2 * (x + 2) + 62 */
-		g_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_uuencode_close (inbuf, len, outbuf, basic->uubuf, &basic->state,
-						      &basic->save);
-		g_assert (newlen <= (len + 2) * 2 + 62);
-		break;
-	case GMIME_FILTER_BASIC_BASE64_DEC:
-		/* output can't possibly exceed the input size */
- 		g_mime_filter_set_size (filter, len, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_base64_decode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len);
-		break;
-	case GMIME_FILTER_BASIC_QP_DEC:
-		/* output can't possibly exceed the input size */
-		g_mime_filter_set_size (filter, len + 2, FALSE);
-		outbuf = (unsigned char *) filter->outbuf;
-		inbuf = (const unsigned char *) in;
-		newlen = g_mime_utils_quoted_decode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-		g_assert (newlen <= len + 2);
-		break;
-	case GMIME_FILTER_BASIC_UU_DEC:
-		if ((basic->state & GMIME_UUDECODE_STATE_BEGIN) && !(basic->state & GMIME_UUDECODE_STATE_END)) {
-			/* "begin <mode> <filename>\n" has been found, so we can now start decoding */
-			g_mime_filter_set_size (filter, len + 3, FALSE);
-			outbuf = (unsigned char *) filter->outbuf;
-			inbuf = (const unsigned char *) in;
-			newlen = g_mime_utils_uudecode_step (inbuf, len, outbuf, &basic->state, &basic->save);
-			g_assert (newlen <= len + 3);
-		} else {
-			newlen = 0;
+	GMimeEncoding *encoder = &basic->encoder;
+	size_t nwritten = 0;
+	size_t len;
+	
+	if (!encoder->encode && encoder->encoding == GMIME_CONTENT_ENCODING_UUENCODE) {
+		switch (encoder->state & GMIME_UUDECODE_STATE_MASK) {
+		case GMIME_UUDECODE_STATE_BEGIN:
+			/* "begin <mode> <filename>\n" has been found and not yet seen the end */
+			break;
+		default:
+			/* either we haven't seen the begin-line or we've finished decoding */
+			goto done;
 		}
-		break;
 	}
 	
-	*out = filter->outbuf;
-	*outlen = newlen;
+	len = g_mime_encoding_outlen (encoder, inlen);
+	g_mime_filter_set_size (filter, len, FALSE);
+	nwritten = g_mime_encoding_flush (encoder, inbuf, inlen, filter->outbuf);
+	g_assert (nwritten <= len);
+	
+ done:
+	
 	*outprespace = filter->outpre;
+	*outbuf = filter->outbuf;
+	*outlen = nwritten;
 }
 
 /* should this 'flush' outstanding state/data bytes? */
@@ -299,35 +227,30 @@
 {
 	GMimeFilterBasic *basic = (GMimeFilterBasic *) filter;
 	
-	switch (basic->type) {
-	case GMIME_FILTER_BASIC_QP_ENC:
-		basic->state = -1;
-		break;
-	default:
-		basic->state = 0;
-	}
-	basic->save = 0;
+	g_mime_encoding_reset (&basic->encoder);
 }
 
 
 /**
- * g_mime_filter_basic_new_type:
- * @type: filter type
+ * g_mime_filter_basic_new:
+ * @encoding: a #GMimeContentEncoding
+ * @encode: %TRUE to encode or %FALSE to decode
  *
- * Creates a new filter of type @type.
+ * Creates a new basic filter for @encoding.
  *
- * Returns a new basic filter of type @type.
+ * Returns a new basic encoder filter.
  **/
 GMimeFilter *
-g_mime_filter_basic_new_type (GMimeFilterBasicType type)
+g_mime_filter_basic_new (GMimeContentEncoding encoding, gboolean encode)
 {
-	GMimeFilterBasic *new;
-	
-	new = g_object_new (GMIME_TYPE_FILTER_BASIC, NULL);
+	GMimeFilterBasic *basic;
 	
-	new->type = type;
+	basic = g_object_new (GMIME_TYPE_FILTER_BASIC, NULL);
 	
-	filter_reset ((GMimeFilter *) new);
+	if (encode)
+		g_mime_encoding_init_encode (&basic->encoder, encoding);
+	else
+		g_mime_encoding_init_decode (&basic->encoder, encoding);
 	
-	return (GMimeFilter *) new;
+	return (GMimeFilter *) basic;
 }

Modified: trunk/gmime/gmime-filter-basic.h
==============================================================================
--- trunk/gmime/gmime-filter-basic.h	(original)
+++ trunk/gmime/gmime-filter-basic.h	Thu May 29 02:25:42 2008
@@ -22,6 +22,7 @@
 #ifndef __GMIME_FILTER_BASIC_H__
 #define __GMIME_FILTER_BASIC_H__
 
+#include <gmime/gmime-encodings.h>
 #include <gmime/gmime-filter.h>
 
 G_BEGIN_DECLS
@@ -36,23 +37,9 @@
 typedef struct _GMimeFilterBasic GMimeFilterBasic;
 typedef struct _GMimeFilterBasicClass GMimeFilterBasicClass;
 
-typedef enum {
-	GMIME_FILTER_BASIC_BASE64_ENC = 1,
-	GMIME_FILTER_BASIC_BASE64_DEC,
-	GMIME_FILTER_BASIC_QP_ENC,
-	GMIME_FILTER_BASIC_QP_DEC,
-	GMIME_FILTER_BASIC_UU_ENC,
-	GMIME_FILTER_BASIC_UU_DEC
-} GMimeFilterBasicType;
-
 struct _GMimeFilterBasic {
 	GMimeFilter parent_object;
-	
-	GMimeFilterBasicType type;
-	
-	unsigned char uubuf[60];
-	guint32 save;
-	int state;
+	GMimeEncoding encoder;
 };
 
 struct _GMimeFilterBasicClass {
@@ -63,7 +50,7 @@
 
 GType g_mime_filter_basic_get_type (void);
 
-GMimeFilter *g_mime_filter_basic_new_type (GMimeFilterBasicType type);
+GMimeFilter *g_mime_filter_basic_new (GMimeContentEncoding encoding, gboolean encode);
 
 G_END_DECLS
 

Modified: trunk/gmime/gmime-filter-best.c
==============================================================================
--- trunk/gmime/gmime-filter-best.c	(original)
+++ trunk/gmime/gmime-filter-best.c	Thu May 29 02:25:42 2008
@@ -288,44 +288,44 @@
  *
  * Returns the best encoding for the stream filtered by @best.
  **/
-GMimePartEncodingType
+GMimeContentEncoding
 g_mime_filter_best_encoding (GMimeFilterBest *best, GMimeBestEncoding required)
 {
-	GMimePartEncodingType encoding = GMIME_PART_ENCODING_DEFAULT;
+	GMimeContentEncoding encoding = GMIME_CONTENT_ENCODING_DEFAULT;
 	
-	g_return_val_if_fail (GMIME_IS_FILTER_BEST (best), GMIME_PART_ENCODING_DEFAULT);
+	g_return_val_if_fail (GMIME_IS_FILTER_BEST (best), GMIME_CONTENT_ENCODING_DEFAULT);
 	
 	if (!(best->flags & GMIME_FILTER_BEST_ENCODING))
-		return GMIME_PART_ENCODING_DEFAULT;
+		return GMIME_CONTENT_ENCODING_DEFAULT;
 	
 	switch (required) {
 	case GMIME_BEST_ENCODING_7BIT:
 		if (best->count0 > 0) {
-			encoding = GMIME_PART_ENCODING_BASE64;
+			encoding = GMIME_CONTENT_ENCODING_BASE64;
 		} else if (best->count8 > 0) {
 			if (best->count8 >= (best->total * 17 / 100))
-				encoding = GMIME_PART_ENCODING_BASE64;
+				encoding = GMIME_CONTENT_ENCODING_BASE64;
 			else
-				encoding = GMIME_PART_ENCODING_QUOTEDPRINTABLE;
+				encoding = GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE;
 		} else if (best->maxline > 998) {
-			encoding = GMIME_PART_ENCODING_QUOTEDPRINTABLE;
+			encoding = GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE;
 		}
 		break;
 	case GMIME_BEST_ENCODING_8BIT:
 		if (best->count0 > 0) {
-			encoding = GMIME_PART_ENCODING_BASE64;
+			encoding = GMIME_CONTENT_ENCODING_BASE64;
 		} else if (best->maxline > 998) {
-			encoding = GMIME_PART_ENCODING_QUOTEDPRINTABLE;
+			encoding = GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE;
 		}
 		break;
 	case GMIME_BEST_ENCODING_BINARY:
 		if (best->count0 + best->count8 > 0)
-			encoding = GMIME_PART_ENCODING_BINARY;
+			encoding = GMIME_CONTENT_ENCODING_BINARY;
 		break;
 	}
 	
-	if (encoding == GMIME_PART_ENCODING_DEFAULT && best->hadfrom)
-		encoding = GMIME_PART_ENCODING_QUOTEDPRINTABLE;
+	if (encoding == GMIME_CONTENT_ENCODING_DEFAULT && best->hadfrom)
+		encoding = GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE;
 	
 	return encoding;
 }

Modified: trunk/gmime/gmime-filter-best.h
==============================================================================
--- trunk/gmime/gmime-filter-best.h	(original)
+++ trunk/gmime/gmime-filter-best.h	Thu May 29 02:25:42 2008
@@ -22,6 +22,7 @@
 #ifndef __GMIME_FILTER_BEST_H__
 #define __GMIME_FILTER_BEST_H__
 
+#include <gmime/gmime-encodings.h>
 #include <gmime/gmime-filter.h>
 #include <gmime/gmime-charset.h>
 #include <gmime/gmime-utils.h>
@@ -85,7 +86,7 @@
 
 const char *g_mime_filter_best_charset (GMimeFilterBest *best);
 
-GMimePartEncodingType g_mime_filter_best_encoding (GMimeFilterBest *best, GMimeBestEncoding required);
+GMimeContentEncoding g_mime_filter_best_encoding (GMimeFilterBest *best, GMimeBestEncoding required);
 
 G_END_DECLS
 

Modified: trunk/gmime/gmime-message-partial.c
==============================================================================
--- trunk/gmime/gmime-message-partial.c	(original)
+++ trunk/gmime/gmime-message-partial.c	Thu May 29 02:25:42 2008
@@ -459,7 +459,7 @@
 	for (i = 0; i < parts->len; i++) {
 		partial = g_mime_message_partial_new (id, i + 1, parts->len);
 		wrapper = g_mime_data_wrapper_new_with_stream (GMIME_STREAM (parts->pdata[i]),
-							       GMIME_PART_ENCODING_DEFAULT);
+							       GMIME_CONTENT_ENCODING_DEFAULT);
 		g_object_unref (parts->pdata[i]);
 		g_mime_part_set_content_object (GMIME_PART (partial), wrapper);
 		g_object_unref (wrapper);

Modified: trunk/gmime/gmime-multipart-encrypted.c
==============================================================================
--- trunk/gmime/gmime-multipart-encrypted.c	(original)
+++ trunk/gmime/gmime-multipart-encrypted.c	Thu May 29 02:25:42 2008
@@ -279,9 +279,9 @@
 	version_part = g_mime_part_new ();
 	content_type = g_mime_content_type_new_from_string (ctx->encrypt_protocol);
 	g_mime_object_set_content_type (GMIME_OBJECT (version_part), content_type);
-	g_mime_part_set_encoding (version_part, GMIME_PART_ENCODING_7BIT);
+	g_mime_part_set_content_encoding (version_part, GMIME_CONTENT_ENCODING_7BIT);
 	stream = g_mime_stream_mem_new_with_buffer ("Version: 1\n", strlen ("Version: 1\n"));
-	wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_7BIT);
+	wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_7BIT);
 	g_mime_part_set_content_object (encrypted_part, wrapper);
 	g_object_unref (wrapper);
 	g_object_unref (stream);
@@ -292,8 +292,8 @@
 	
 	/* construct the encrypted mime part */
 	encrypted_part = g_mime_part_new_with_type ("application", "octet-stream");
-	g_mime_part_set_encoding (encrypted_part, GMIME_PART_ENCODING_7BIT);
-	wrapper = g_mime_data_wrapper_new_with_stream (ciphertext, GMIME_PART_ENCODING_7BIT);
+	g_mime_part_set_content_encoding (encrypted_part, GMIME_CONTENT_ENCODING_7BIT);
+	wrapper = g_mime_data_wrapper_new_with_stream (ciphertext, GMIME_CONTENT_ENCODING_7BIT);
 	g_mime_part_set_content_object (encrypted_part, wrapper);
 	g_object_unref (ciphertext);
 	g_object_unref (wrapper);

Modified: trunk/gmime/gmime-multipart-signed.c
==============================================================================
--- trunk/gmime/gmime-multipart-signed.c	(original)
+++ trunk/gmime/gmime-multipart-signed.c	Thu May 29 02:25:42 2008
@@ -228,7 +228,7 @@
 static void
 sign_prepare (GMimeObject *mime_part)
 {
-	GMimePartEncodingType encoding;
+	GMimeContentEncoding encoding;
 	GMimeObject *subpart;
 	
 	if (GMIME_IS_MULTIPART (mime_part)) {
@@ -249,11 +249,11 @@
 		subpart = GMIME_MESSAGE_PART (mime_part)->message->mime_part;
 		sign_prepare (subpart);
 	} else {
-		encoding = g_mime_part_get_encoding (GMIME_PART (mime_part));
+		encoding = g_mime_part_get_content_encoding (GMIME_PART (mime_part));
 		
-		if (encoding != GMIME_PART_ENCODING_BASE64)
-			g_mime_part_set_encoding (GMIME_PART (mime_part),
-						  GMIME_PART_ENCODING_QUOTEDPRINTABLE);
+		if (encoding != GMIME_CONTENT_ENCODING_BASE64)
+			g_mime_part_set_content_encoding (GMIME_PART (mime_part),
+							  GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
 	}
 }
 
@@ -363,8 +363,8 @@
 	 * the CipherContext class - maybe ::sign can take/output a
 	 * GMimePart instead. */
 	if (!g_ascii_strcasecmp (mps->protocol, "application/pkcs7-signature")) {
+		g_mime_part_set_content_encoding (GMIME_PART (signature), GMIME_CONTENT_ENCODING_BASE64);
 		g_mime_part_set_filename (GMIME_PART (signature), "smime.p7m");
-		g_mime_part_set_encoding (GMIME_PART (signature), GMIME_PART_ENCODING_BASE64);
 	}
 	
 	/* save the content and signature parts */

Modified: trunk/gmime/gmime-multipart.c
==============================================================================
--- trunk/gmime/gmime-multipart.c	(original)
+++ trunk/gmime/gmime-multipart.c	Thu May 29 02:25:42 2008
@@ -685,7 +685,7 @@
 		
 		strcpy (bbuf, "=-");
 		p = (unsigned char *) bbuf + 2;
-		p += g_mime_utils_base64_encode_step (digest, 16, p, &state, &save);
+		p += g_mime_encoding_base64_encode_close (digest, 16, p, &state, &save);
 		*p = '\0';
 		
 		boundary = bbuf;

Modified: trunk/gmime/gmime-parser.c
==============================================================================
--- trunk/gmime/gmime-parser.c	(original)
+++ trunk/gmime/gmime-parser.c	Thu May 29 02:25:42 2008
@@ -1267,7 +1267,7 @@
 parser_scan_mime_part_content (GMimeParser *parser, GMimePart *mime_part, int *found)
 {
 	struct _GMimeParserPrivate *priv = parser->priv;
-	GMimePartEncodingType encoding;
+	GMimeContentEncoding encoding;
 	GByteArray *content = NULL;
 	GMimeDataWrapper *wrapper;
 	GMimeStream *stream;
@@ -1294,7 +1294,7 @@
 		end = parser_offset (priv, NULL);
 	}
 	
-	encoding = g_mime_part_get_encoding (mime_part);
+	encoding = g_mime_part_get_content_encoding (mime_part);
 	
 	if (priv->persist_stream && priv->seekable)
 		stream = g_mime_stream_substream (priv->stream, start, end);

Modified: trunk/gmime/gmime-part.c
==============================================================================
--- trunk/gmime/gmime-part.c	(original)
+++ trunk/gmime/gmime-part.c	Thu May 29 02:25:42 2008
@@ -67,10 +67,6 @@
 static char *mime_part_get_headers (GMimeObject *object);
 static ssize_t mime_part_write_to_stream (GMimeObject *object, GMimeStream *stream);
 
-#define NEEDS_DECODING(encoding) (((GMimePartEncodingType) encoding) == GMIME_PART_ENCODING_BASE64 ||   \
-				  ((GMimePartEncodingType) encoding) == GMIME_PART_ENCODING_UUENCODE || \
-				  ((GMimePartEncodingType) encoding) == GMIME_PART_ENCODING_QUOTEDPRINTABLE)
-
 
 static GMimeObjectClass *parent_class = NULL;
 
@@ -122,7 +118,7 @@
 static void
 g_mime_part_init (GMimePart *mime_part, GMimePartClass *klass)
 {
-	mime_part->encoding = GMIME_PART_ENCODING_DEFAULT;
+	mime_part->encoding = GMIME_CONTENT_ENCODING_DEFAULT;
 	mime_part->content_description = NULL;
 	mime_part->content_location = NULL;
 	mime_part->content_md5 = NULL;
@@ -186,7 +182,7 @@
 		text = g_alloca (strlen (value) + 1);
 		strcpy (text, value);
 		g_strstrip (text);
-		mime_part->encoding = g_mime_part_encoding_from_string (text);
+		mime_part->encoding = g_mime_content_encoding_from_string (text);
 		break;
 	case HEADER_CONTENT_DESCRIPTION:
 		/* FIXME: we should decode this */
@@ -284,19 +280,8 @@
 		const char *filename;
 		GMimeFilter *filter;
 		
-		filtered_stream = g_mime_stream_filter_new_with_stream (stream);
 		switch (part->encoding) {
-		case GMIME_PART_ENCODING_BASE64:
-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_BASE64_ENC);
-			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
-			g_object_unref (filter);
-			break;
-		case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_QP_ENC);
-			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
-			g_object_unref (filter);
-			break;
-		case GMIME_PART_ENCODING_UUENCODE:
+		case GMIME_CONTENT_ENCODING_UUENCODE:
 			filename = g_mime_part_get_filename (part);
 			nwritten = g_mime_stream_printf (stream, "begin 0644 %s\n",
 							 filename ? filename : "unknown");
@@ -307,11 +292,17 @@
 			
 			total += nwritten;
 			
-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_ENC);
+			/* fall thru... */
+		case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
+		case GMIME_CONTENT_ENCODING_BASE64:
+			filter = g_mime_filter_basic_new (part->encoding, TRUE);
+			filtered_stream = g_mime_stream_filter_new_with_stream (stream);
 			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
 			g_object_unref (filter);
 			break;
 		default:
+			filtered_stream = stream;
+			g_object_ref (stream);
 			break;
 		}
 		
@@ -324,7 +315,7 @@
 		
 		total += nwritten;
 		
-		if (part->encoding == GMIME_PART_ENCODING_UUENCODE) {
+		if (part->encoding == GMIME_CONTENT_ENCODING_UUENCODE) {
 			/* FIXME: get rid of this special-case x-uuencode crap */
 			nwritten = g_mime_stream_write (stream, "end\n", 4);
 			if (nwritten == -1)
@@ -586,7 +577,7 @@
 		g_mime_filter_md5_get_digest ((GMimeFilterMd5 *) md5_filter, digest);
 		g_object_unref (md5_filter);
 		
-		len = g_mime_utils_base64_encode_close (digest, 16, b64digest, &state, &save);
+		len = g_mime_encoding_base64_encode_close (digest, 16, b64digest, &state, &save);
 		b64digest[len] = '\0';
 		g_strstrip ((char *) b64digest);
 		
@@ -651,7 +642,7 @@
 	g_mime_filter_md5_get_digest ((GMimeFilterMd5 *) md5_filter, digest);
 	g_object_unref (md5_filter);
 	
-	len = g_mime_utils_base64_encode_close (digest, 16, b64digest, &state, &save);
+	len = g_mime_encoding_base64_encode_close (digest, 16, b64digest, &state, &save);
 	b64digest[len] = '\0';
 	g_strstrip ((char *) b64digest);
 	
@@ -679,7 +670,7 @@
 
 /**
  * g_mime_part_set_content_location:
- * @mime_part: Mime part
+ * @mime_part: a #GMimePart object
  * @content_location: content location
  *
  * Set the content location for the specified mime part.
@@ -699,7 +690,7 @@
 
 /**
  * g_mime_part_get_content_location:
- * @mime_part: Mime part
+ * @mime_part: a #GMimePart object
  *
  * Gets the value of the Content-Location header if it exists, or
  * %NULL otherwise.
@@ -716,157 +707,41 @@
 
 
 /**
- * g_mime_part_set_content_type:
- * @mime_part: Mime part
- * @mime_type: Mime content-type
- *
- * Set the content type/subtype for the specified mime part.
- **/
-void
-g_mime_part_set_content_type (GMimePart *mime_part, GMimeContentType *mime_type)
-{
-	g_return_if_fail (GMIME_IS_PART (mime_part));
-	g_return_if_fail (mime_type != NULL);
-	
-	g_mime_object_set_content_type (GMIME_OBJECT (mime_part), mime_type);
-}
-
-
-/**
- * g_mime_part_get_content_type: Get the content type/subtype
- * @mime_part: Mime part
- *
- * Gets the Content-Type object for the given mime part or %NULL on
- * error.
- *
- * Returns the content-type object for the specified mime part.
- **/
-const GMimeContentType *
-g_mime_part_get_content_type (GMimePart *mime_part)
-{
-	g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
-	
-	return g_mime_object_get_content_type (GMIME_OBJECT (mime_part));
-}
-
-
-/**
- * g_mime_part_set_encoding: Set the content encoding
- * @mime_part: Mime part
- * @encoding: Mime encoding
+ * g_mime_part_set_content_encoding:
+ * @mime_part: a #GMimePart
+ * @encoding: a #GMimeContentEncoding
  *
- * Set the content encoding for the specified mime part. Available
- * values for the encoding are: GMIME_PART_ENCODING_DEFAULT,
- * GMIME_PART_ENCODING_7BIT, GMIME_PART_ENCODING_8BIT,
- * GMIME_PART_ENCODING_BINARY, GMIME_PART_ENCODING_BASE64 and
- * GMIME_PART_ENCODING_QUOTEDPRINTABLE.
+ * Set the content encoding for the specified mime part.
  **/
 void
-g_mime_part_set_encoding (GMimePart *mime_part, GMimePartEncodingType encoding)
+g_mime_part_set_content_encoding (GMimePart *mime_part, GMimeContentEncoding encoding)
 {
 	g_return_if_fail (GMIME_IS_PART (mime_part));
 	
 	mime_part->encoding = encoding;
 	g_mime_header_set (GMIME_OBJECT (mime_part)->headers, "Content-Transfer-Encoding",
-			   g_mime_part_encoding_to_string (encoding));
+			   g_mime_content_encoding_to_string (encoding));
 }
 
 
 /**
- * g_mime_part_get_encoding: Get the content encoding
- * @mime_part: Mime part
+ * g_mime_part_get_content_encoding:
+ * @mime_part: a #GMimePart
  *
  * Gets the content encoding of the mime part.
  *
- * Returns the content encoding for the specified mime part. The
- * return value will be one of the following:
- * #GMIME_PART_ENCODING_DEFAULT, #GMIME_PART_ENCODING_7BIT,
- * #GMIME_PART_ENCODING_8BIT, #GMIME_PART_ENCODING_BINARY,
- * #GMIME_PART_ENCODING_BASE64, #GMIME_PART_ENCODING_QUOTEDPRINTABLE
- * or #GMIME_PART_ENCODING_UUENCODE.
+ * Returns the content encoding for the specified mime part.
  **/
-GMimePartEncodingType
-g_mime_part_get_encoding (GMimePart *mime_part)
+GMimeContentEncoding
+g_mime_part_get_content_encoding (GMimePart *mime_part)
 {
-	g_return_val_if_fail (GMIME_IS_PART (mime_part), GMIME_PART_ENCODING_DEFAULT);
+	g_return_val_if_fail (GMIME_IS_PART (mime_part), GMIME_CONTENT_ENCODING_DEFAULT);
 	
 	return mime_part->encoding;
 }
 
 
 /**
- * g_mime_part_encoding_to_string:
- * @encoding: Mime encoding
- *
- * Gets the string value of the content encoding.
- *
- * Returns the encoding type as a string. Available
- * values for the encoding are: #GMIME_PART_ENCODING_DEFAULT,
- * #GMIME_PART_ENCODING_7BIT, #GMIME_PART_ENCODING_8BIT,
- * #GMIME_PART_ENCODING_BINARY, #GMIME_PART_ENCODING_BASE64,
- * #GMIME_PART_ENCODING_QUOTEDPRINTABLE and
- * #GMIME_PART_ENCODING_UUENCODE.
- **/
-const char *
-g_mime_part_encoding_to_string (GMimePartEncodingType encoding)
-{
-	switch (encoding) {
-        case GMIME_PART_ENCODING_7BIT:
-		return "7bit";
-        case GMIME_PART_ENCODING_8BIT:
-		return "8bit";
-	case GMIME_PART_ENCODING_BINARY:
-		return "binary";
-        case GMIME_PART_ENCODING_BASE64:
-		return "base64";
-        case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
-		return "quoted-printable";
-	case GMIME_PART_ENCODING_UUENCODE:
-		return "x-uuencode";
-	default:
-		/* I guess this is a good default... */
-		return NULL;
-	}
-}
-
-
-/**
- * g_mime_part_encoding_from_string:
- * @encoding: Mime encoding in string format
- *
- * Gets the content encoding enumeration value based on the input
- * string.
- *
- * Returns the encoding string as a #GMimePartEncodingType.  Available
- * values for the encoding are: #GMIME_PART_ENCODING_DEFAULT,
- * #GMIME_PART_ENCODING_7BIT, #GMIME_PART_ENCODING_8BIT,
- * #GMIME_PART_ENCODING_BINARY, #GMIME_PART_ENCODING_BASE64,
- * #GMIME_PART_ENCODING_QUOTEDPRINTABLE and
- * #GMIME_PART_ENCODING_UUENCODE.
- **/
-GMimePartEncodingType
-g_mime_part_encoding_from_string (const char *encoding)
-{
-	if (!g_ascii_strcasecmp (encoding, "7bit"))
-		return GMIME_PART_ENCODING_7BIT;
-	else if (!g_ascii_strcasecmp (encoding, "8bit"))
-		return GMIME_PART_ENCODING_8BIT;
-	else if (!g_ascii_strcasecmp (encoding, "binary"))
-		return GMIME_PART_ENCODING_BINARY;
-	else if (!g_ascii_strcasecmp (encoding, "base64"))
-		return GMIME_PART_ENCODING_BASE64;
-	else if (!g_ascii_strcasecmp (encoding, "quoted-printable"))
-		return GMIME_PART_ENCODING_QUOTEDPRINTABLE;
-	else if (!g_ascii_strcasecmp (encoding, "uuencode"))
-		return GMIME_PART_ENCODING_UUENCODE;
-	else if (!g_ascii_strcasecmp (encoding, "x-uuencode"))
-		return GMIME_PART_ENCODING_UUENCODE;
-	else
-		return GMIME_PART_ENCODING_DEFAULT;
-}
-
-
-/**
  * g_mime_part_set_filename:
  * @mime_part: Mime part
  * @filename: the filename of the Mime Part's content

Modified: trunk/gmime/gmime-part.h
==============================================================================
--- trunk/gmime/gmime-part.h	(original)
+++ trunk/gmime/gmime-part.h	Thu May 29 02:25:42 2008
@@ -26,6 +26,7 @@
 #include <stdio.h>
 
 #include <gmime/gmime-object.h>
+#include <gmime/gmime-encodings.h>
 #include <gmime/gmime-data-wrapper.h>
 
 G_BEGIN_DECLS
@@ -43,7 +44,7 @@
 struct _GMimePart {
 	GMimeObject parent_object;
 	
-	GMimePartEncodingType encoding;
+	GMimeContentEncoding encoding;
 	char *content_description;
 	char *content_location;
 	char *content_md5;
@@ -80,10 +81,8 @@
 void g_mime_part_set_content_location (GMimePart *mime_part, const char *content_location);
 const char *g_mime_part_get_content_location (GMimePart *mime_part);
 
-void g_mime_part_set_encoding (GMimePart *mime_part, GMimePartEncodingType encoding);
-GMimePartEncodingType g_mime_part_get_encoding (GMimePart *mime_part);
-const char *g_mime_part_encoding_to_string (GMimePartEncodingType encoding);
-GMimePartEncodingType g_mime_part_encoding_from_string (const char *encoding);
+void g_mime_part_set_content_encoding (GMimePart *mime_part, GMimeContentEncoding encoding);
+GMimeContentEncoding g_mime_part_get_content_encoding (GMimePart *mime_part);
 
 void g_mime_part_set_filename (GMimePart *mime_part, const char *filename);
 const char *g_mime_part_get_filename (const GMimePart *mime_part);

Modified: trunk/gmime/gmime-utils.c
==============================================================================
--- trunk/gmime/gmime-utils.c	(original)
+++ trunk/gmime/gmime-utils.c	Thu May 29 02:25:42 2008
@@ -69,10 +69,6 @@
  * and encodings.
  **/
 
-
-#define GMIME_UUENCODE_CHAR(c) ((c) ? (c) + ' ' : '`')
-#define	GMIME_UUDECODE_CHAR(c) (((c) - ' ') & 077)
-
 #define GMIME_FOLD_PREENCODED  (GMIME_FOLD_LEN / 2)
 
 /* date parser macros */
@@ -92,52 +88,11 @@
 #define DATE_TOKEN_NON_TIMEZONE_NUMERIC (1 << 6)
 #define DATE_TOKEN_HAS_SIGN             (1 << 7)
 
-
-static char base64_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
 static unsigned char tohex[16] = {
 	'0', '1', '2', '3', '4', '5', '6', '7',
 	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
 };
 
-static unsigned char gmime_base64_rank[256] = {
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63,
-	 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255,  0,255,255,
-	255,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
-	 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255,
-	255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-	 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-static unsigned char gmime_uu_rank[256] = {
-	 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-	 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
-	  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-	 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-	 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
-	  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-	 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-	 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
-	  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-	 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-	 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
-	  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-};
-
 static unsigned char gmime_datetok_table[256] = {
 	128,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
 	111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
@@ -1060,26 +1015,38 @@
 
 
 /**
- * g_mime_references_clear:
- * @refs: address of a #GMimeReferences list
+ * g_mime_references_free:
+ * @refs: a #GMimeReferences list
  *
- * Clears the #GMimeReferences list and resets it to %NULL.
+ * Frees the #GMimeReferences list.
  **/
 void
-g_mime_references_clear (GMimeReferences **refs)
+g_mime_references_free (GMimeReferences *refs)
 {
 	GMimeReferences *ref, *next;
 	
-	g_return_if_fail (refs != NULL);
-	
-	ref = *refs;
+	ref = refs;
 	while (ref) {
 		next = ref->next;
 		g_free (ref->msgid);
 		g_free (ref);
 		ref = next;
 	}
+}
+
+
+/**
+ * g_mime_references_clear:
+ * @refs: address of a #GMimeReferences list
+ *
+ * Clears the #GMimeReferences list and resets it to %NULL.
+ **/
+void
+g_mime_references_clear (GMimeReferences **refs)
+{
+	g_return_if_fail (refs != NULL);
 	
+	g_mime_references_free (*refs);
 	*refs = NULL;
 }
 
@@ -1442,11 +1409,11 @@
  * Determines the best content encoding for the first @len bytes of
  * @text.
  *
- * Returns a #GMimePartEncodingType that is determined to be the best
+ * Returns a #GMimeContentEncoding that is determined to be the best
  * encoding type for the specified block of text. ("best" in this
- * particular case means best compression)
+ * particular case means smallest output size)
  **/
-GMimePartEncodingType
+GMimeContentEncoding
 g_mime_utils_best_encoding (const unsigned char *text, size_t len)
 {
 	const unsigned char *ch, *inend;
@@ -1458,9 +1425,9 @@
 			count++;
 	
 	if ((float) count <= len * 0.17)
-		return GMIME_PART_ENCODING_QUOTEDPRINTABLE;
+		return GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE;
 	else
-		return GMIME_PART_ENCODING_BASE64;
+		return GMIME_CONTENT_ENCODING_BASE64;
 }
 
 
@@ -1730,7 +1697,7 @@
 	case 'b':
 		inptr += 2;
 		decoded = g_alloca (inend - inptr);
-		declen = g_mime_utils_base64_decode_step (inptr, inend - inptr, decoded, &state, &save);
+		declen = g_mime_encoding_base64_decode_step (inptr, inend - inptr, decoded, &state, &save);
 		break;
 	case 'Q':
 	case 'q':
@@ -2080,13 +2047,13 @@
 	}
 	
 	switch (g_mime_utils_best_encoding ((const unsigned char *) word, len)) {
-	case GMIME_PART_ENCODING_BASE64:
+	case GMIME_CONTENT_ENCODING_BASE64:
 		enclen = GMIME_BASE64_ENCODE_LEN (len);
 		encoded = g_alloca (enclen + 1);
 		
 		encoding = 'b';
 		
-		pos = g_mime_utils_base64_encode_close ((const unsigned char *) word, len, encoded, &state, &save);
+		pos = g_mime_encoding_base64_encode_close ((const unsigned char *) word, len, encoded, &state, &save);
 		encoded[pos] = '\0';
 		
 		/* remove \n chars as headers need to be wrapped differently */
@@ -2103,7 +2070,7 @@
 		}
 		
 		break;
-	case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
+	case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
 		enclen = GMIME_QP_ENCODE_LEN (len);
 		encoded = g_alloca (enclen + 1);
 		
@@ -2498,750 +2465,3 @@
 	
 	return rfc2047_encode (text, IS_ESAFE);
 }
-
-
-/**
- * g_mime_utils_base64_encode_close:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Base64 encodes the input stream to the output stream. Call this
- * when finished encoding data with g_mime_utils_base64_encode_step()
- * to flush off the last little bit.
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_base64_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	unsigned char *outptr = outbuf;
-	int c1, c2;
-	
-	if (inlen > 0)
-		outptr += g_mime_utils_base64_encode_step (inbuf, inlen, outptr, state, save);
-	
-	c1 = ((unsigned char *)save)[1];
-	c2 = ((unsigned char *)save)[2];
-	
-	switch (((unsigned char *)save)[0]) {
-	case 2:
-		outptr[2] = base64_alphabet [(c2 & 0x0f) << 2];
-		goto skip;
-	case 1:
-		outptr[2] = '=';
-	skip:
-		outptr[0] = base64_alphabet [c1 >> 2];
-		outptr[1] = base64_alphabet [c2 >> 4 | ((c1 & 0x3) << 4)];
-		outptr[3] = '=';
-		outptr += 4;
-		break;
-	}
-	
-	*outptr++ = '\n';
-	
-	*save = 0;
-	*state = 0;
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_base64_encode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Base64 encodes a chunk of data. Performs an 'encode step', only
- * encodes blocks of 3 characters to the output at a time, saves
- * left-over state in state and save (initialise to 0 on first
- * invocation).
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_base64_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	const register unsigned char *inptr;
-	register unsigned char *outptr;
-	
-	if (inlen == 0)
-		return 0;
-	
-	outptr = outbuf;
-	inptr = inbuf;
-	
-	if (inlen + ((unsigned char *)save)[0] > 2) {
-		const unsigned char *inend = inbuf + inlen - 2;
-		register int c1 = 0, c2 = 0, c3 = 0;
-		register int already;
-		
-		already = *state;
-		
-		switch (((char *)save)[0]) {
-		case 1:	c1 = ((unsigned char *)save)[1]; goto skip1;
-		case 2:	c1 = ((unsigned char *)save)[1];
-			c2 = ((unsigned char *)save)[2]; goto skip2;
-		}
-		
-		/* yes, we jump into the loop, no i'm not going to change it, its beautiful! */
-		while (inptr < inend) {
-			c1 = *inptr++;
-		skip1:
-			c2 = *inptr++;
-		skip2:
-			c3 = *inptr++;
-			*outptr++ = base64_alphabet [c1 >> 2];
-			*outptr++ = base64_alphabet [(c2 >> 4) | ((c1 & 0x3) << 4)];
-			*outptr++ = base64_alphabet [((c2 & 0x0f) << 2) | (c3 >> 6)];
-			*outptr++ = base64_alphabet [c3 & 0x3f];
-			/* this is a bit ugly ... */
-			if ((++already) >= 19) {
-				*outptr++ = '\n';
-				already = 0;
-			}
-		}
-		
-		((unsigned char *)save)[0] = 0;
-		inlen = 2 - (inptr - inend);
-		*state = already;
-	}
-	
-	d(printf ("state = %d, inlen = %d\n", (int)((char *)save)[0], inlen));
-	
-	if (inlen > 0) {
-		register char *saveout;
-		
-		/* points to the slot for the next char to save */
-		saveout = & (((char *)save)[1]) + ((char *)save)[0];
-		
-		/* inlen can only be 0 1 or 2 */
-		switch (inlen) {
-		case 2:	*saveout++ = *inptr++;
-		case 1:	*saveout++ = *inptr++;
-		}
-		((char *)save)[0] += inlen;
-	}
-	
-	d(printf ("mode = %d\nc1 = %c\nc2 = %c\n",
-		  (int)((char *)save)[0],
-		  (int)((char *)save)[1],
-		  (int)((char *)save)[2]));
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_base64_decode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a chunk of base64 encoded data.
- *
- * Returns the number of bytes decoded (which have been dumped in
- * @outbuf).
- **/
-size_t
-g_mime_utils_base64_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	const register unsigned char *inptr;
-	register unsigned char *outptr;
-	const unsigned char *inend;
-	register guint32 saved;
-	unsigned char c;
-	int i;
-	
-	inend = inbuf + inlen;
-	outptr = outbuf;
-	
-	/* convert 4 base64 bytes to 3 normal bytes */
-	saved = *save;
-	i = *state;
-	inptr = inbuf;
-	while (inptr < inend) {
-		c = gmime_base64_rank[*inptr++];
-		if (c != 0xff) {
-			saved = (saved << 6) | c;
-			i++;
-			if (i == 4) {
-				*outptr++ = saved >> 16;
-				*outptr++ = saved >> 8;
-				*outptr++ = saved;
-				i = 0;
-			}
-		}
-	}
-	
-	*save = saved;
-	*state = i;
-	
-	/* quick scan back for '=' on the end somewhere */
-	/* fortunately we can drop 1 output char for each trailing = (upto 2) */
-	i = 2;
-	while (inptr > inbuf && i) {
-		inptr--;
-		if (gmime_base64_rank[*inptr] != 0xff) {
-			if (*inptr == '=' && outptr > outbuf)
-				outptr--;
-			i--;
-		}
-	}
-	
-	/* if i != 0 then there is a truncation error! */
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_uuencode_close:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @uubuf: temporary buffer of 60 bytes
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Uuencodes a chunk of data. Call this when finished encoding data
- * with g_mime_utils_uuencode_step() to flush off the last little bit.
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_uuencode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save)
-{
-	register unsigned char *outptr, *bufptr;
-	register guint32 saved;
-	int uulen, uufill, i;
-	
-	outptr = outbuf;
-	
-	if (inlen > 0)
-		outptr += g_mime_utils_uuencode_step (inbuf, inlen, outbuf, uubuf, state, save);
-	
-	uufill = 0;
-	
-	saved = *save;
-	i = *state & 0xff;
-	uulen = (*state >> 8) & 0xff;
-	
-	bufptr = uubuf + ((uulen / 3) * 4);
-	
-	if (i > 0) {
-		while (i < 3) {
-			saved <<= 8;
-			uufill++;
-			i++;
-		}
-		
-		if (i == 3) {
-			/* convert 3 normal bytes into 4 uuencoded bytes */
-			unsigned char b0, b1, b2;
-			
-			b0 = (saved >> 16) & 0xff;
-			b1 = (saved >> 8) & 0xff;
-			b2 = saved & 0xff;
-			
-			*bufptr++ = GMIME_UUENCODE_CHAR ((b0 >> 2) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (((b0 << 4) | ((b1 >> 4) & 0xf)) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (((b1 << 2) | ((b2 >> 6) & 0x3)) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (b2 & 0x3f);
-			
-			uulen += 3;
-			saved = 0;
-			i = 0;
-		}
-	}
-	
-	if (uulen > 0) {
-		int cplen = ((uulen / 3) * 4);
-		
-		*outptr++ = GMIME_UUENCODE_CHAR ((uulen - uufill) & 0xff);
-		memcpy (outptr, uubuf, cplen);
-		outptr += cplen;
-		*outptr++ = '\n';
-		uulen = 0;
-	}
-	
-	*outptr++ = GMIME_UUENCODE_CHAR (uulen & 0xff);
-	*outptr++ = '\n';
-	
-	*save = 0;
-	*state = 0;
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_uuencode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output stream
- * @uubuf: temporary buffer of 60 bytes
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Uuencodes a chunk of data. Performs an 'encode step', only encodes
- * blocks of 45 characters to the output at a time, saves left-over
- * state in @uubuf, @state and @save (initialize to 0 on first
- * invocation).
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_uuencode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save)
-{
-	register unsigned char *outptr, *bufptr;
-	const register unsigned char *inptr;
-	const unsigned char *inend;
-	unsigned char b0, b1, b2;
-	guint32 saved;
-	int uulen, i;
-	
-	if (inlen == 0)
-		return 0;
-	
-	inend = inbuf + inlen;
-	outptr = outbuf;
-	inptr = inbuf;
-	
-	saved = *save;
-	i = *state & 0xff;
-	uulen = (*state >> 8) & 0xff;
-	
-	if ((inlen + uulen) < 45) {
-		/* not enough input to write a full uuencoded line */
-		bufptr = uubuf + ((uulen / 3) * 4);
-	} else {
-		bufptr = outptr + 1;
-		
-		if (uulen > 0) {
-			/* copy the previous call's tmpbuf to outbuf */
-			memcpy (bufptr, uubuf, ((uulen / 3) * 4));
-			bufptr += ((uulen / 3) * 4);
-		}
-	}
-	
-	if (i == 2) {
-		b0 = (saved >> 8) & 0xff;
-		b1 = saved & 0xff;
-		saved = 0;
-		i = 0;
-		
-		goto skip2;
-	} else if (i == 1) {
-		if ((inptr + 2) < inend) {
-			b0 = saved & 0xff;
-			saved = 0;
-			i = 0;
-			
-			goto skip1;
-		}
-		
-		while (inptr < inend) {
-			saved = (saved << 8) | *inptr++;
-			i++;
-		}
-	}
-	
-	while (inptr < inend) {
-		while (uulen < 45 && (inptr + 3) <= inend) {
-			b0 = *inptr++;
-		skip1:
-			b1 = *inptr++;
-		skip2:
-			b2 = *inptr++;
-			
-			/* convert 3 normal bytes into 4 uuencoded bytes */
-			*bufptr++ = GMIME_UUENCODE_CHAR ((b0 >> 2) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (((b0 << 4) | ((b1 >> 4) & 0xf)) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (((b1 << 2) | ((b2 >> 6) & 0x3)) & 0x3f);
-			*bufptr++ = GMIME_UUENCODE_CHAR (b2 & 0x3f);
-			
-			uulen += 3;
-		}
-		
-		if (uulen >= 45) {
-			/* output the uu line length */
-			*outptr = GMIME_UUENCODE_CHAR (uulen & 0xff);
-			outptr += ((45 / 3) * 4) + 1;
-			
-			*outptr++ = '\n';
-			uulen = 0;
-			
-			if ((inptr + 45) <= inend) {
-				/* we have enough input to output another full line */
-				bufptr = outptr + 1;
-			} else {
-				bufptr = uubuf;
-			}
-		} else {
-			/* not enough input to continue... */
-			for (i = 0, saved = 0; inptr < inend; i++)
-				saved = (saved << 8) | *inptr++;
-		}
-	}
-	
-	*save = saved;
-	*state = ((uulen & 0xff) << 8) | (i & 0xff);
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_uudecode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Uudecodes a chunk of data. Performs a 'decode step' on a chunk of
- * uuencoded data. Assumes the "begin mode filename" line has
- * been stripped off.
- *
- * Returns the number of bytes decoded.
- **/
-size_t
-g_mime_utils_uudecode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	const register unsigned char *inptr;
-	register unsigned char *outptr;
-	const unsigned char *inend;
-	unsigned char ch;
-	register guint32 saved;
-	gboolean last_was_eoln;
-	int uulen, i;
-	
-	if (*state & GMIME_UUDECODE_STATE_END)
-		return 0;
-	
-	saved = *save;
-	i = *state & 0xff;
-	uulen = (*state >> 8) & 0xff;
-	if (uulen == 0)
-		last_was_eoln = TRUE;
-	else
-		last_was_eoln = FALSE;
-	
-	inend = inbuf + inlen;
-	outptr = outbuf;
-	inptr = inbuf;
-	
-	while (inptr < inend) {
-		if (*inptr == '\n') {
-			last_was_eoln = TRUE;
-			
-			inptr++;
-			continue;
-		} else if (!uulen || last_was_eoln) {
-			/* first octet on a line is the uulen octet */
-			uulen = gmime_uu_rank[*inptr];
-			last_was_eoln = FALSE;
-			if (uulen == 0) {
-				*state |= GMIME_UUDECODE_STATE_END;
-				break;
-			}
-			
-			inptr++;
-			continue;
-		}
-		
-		ch = *inptr++;
-		
-		if (uulen > 0) {
-			/* save the byte */
-			saved = (saved << 8) | ch;
-			i++;
-			if (i == 4) {
-				/* convert 4 uuencoded bytes to 3 normal bytes */
-				unsigned char b0, b1, b2, b3;
-				
-				b0 = saved >> 24;
-				b1 = saved >> 16 & 0xff;
-				b2 = saved >> 8 & 0xff;
-				b3 = saved & 0xff;
-				
-				if (uulen >= 3) {
-					*outptr++ = gmime_uu_rank[b0] << 2 | gmime_uu_rank[b1] >> 4;
-					*outptr++ = gmime_uu_rank[b1] << 4 | gmime_uu_rank[b2] >> 2;
-				        *outptr++ = gmime_uu_rank[b2] << 6 | gmime_uu_rank[b3];
-				} else {
-					if (uulen >= 1) {
-						*outptr++ = gmime_uu_rank[b0] << 2 | gmime_uu_rank[b1] >> 4;
-					}
-					if (uulen >= 2) {
-						*outptr++ = gmime_uu_rank[b1] << 4 | gmime_uu_rank[b2] >> 2;
-					}
-				}
-				
-				i = 0;
-				saved = 0;
-				uulen -= 3;
-			}
-		} else {
-			break;
-		}
-	}
-	
-	*save = saved;
-	*state = (*state & GMIME_UUDECODE_STATE_MASK) | ((uulen & 0xff) << 8) | (i & 0xff);
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_quoted_encode_close:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Quoted-printable encodes a block of text. Call this when finished
- * encoding data with g_mime_utils_quoted_encode_step() to flush off
- * the last little bit.
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_quoted_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	register unsigned char *outptr = outbuf;
-	int last;
-	
-	if (inlen > 0)
-		outptr += g_mime_utils_quoted_encode_step (inbuf, inlen, outptr, state, save);
-	
-	last = *state;
-	if (last != -1) {
-		/* space/tab must be encoded if its the last character on
-		   the line */
-		if (is_qpsafe (last) && !is_blank (last)) {
-			*outptr++ = last;
-		} else {
-			*outptr++ = '=';
-			*outptr++ = tohex[(last >> 4) & 0xf];
-			*outptr++ = tohex[last & 0xf];
-		}
-	}
-	
-	*outptr++ = '\n';
-	
-	*save = 0;
-	*state = -1;
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_quoted_encode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been encoded
- *
- * Quoted-printable encodes a block of text. Performs an 'encode
- * step', saves left-over state in state and save (initialise to -1 on
- * first invocation).
- *
- * Returns the number of bytes encoded.
- **/
-size_t
-g_mime_utils_quoted_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	const register unsigned char *inptr = inbuf;
-	const unsigned char *inend = inbuf + inlen;
-	register unsigned char *outptr = outbuf;
-	register guint32 sofar = *save;  /* keeps track of how many chars on a line */
-	register int last = *state;  /* keeps track if last char to end was a space cr etc */
-	unsigned char c;
-	
-	while (inptr < inend) {
-		c = *inptr++;
-		if (c == '\r') {
-			if (last != -1) {
-				*outptr++ = '=';
-				*outptr++ = tohex[(last >> 4) & 0xf];
-				*outptr++ = tohex[last & 0xf];
-				sofar += 3;
-			}
-			last = c;
-		} else if (c == '\n') {
-			if (last != -1 && last != '\r') {
-				*outptr++ = '=';
-				*outptr++ = tohex[(last >> 4) & 0xf];
-				*outptr++ = tohex[last & 0xf];
-			}
-			*outptr++ = '\n';
-			sofar = 0;
-			last = -1;
-		} else {
-			if (last != -1) {
-				if (is_qpsafe (last)) {
-					*outptr++ = last;
-					sofar++;
-				} else {
-					*outptr++ = '=';
-					*outptr++ = tohex[(last >> 4) & 0xf];
-					*outptr++ = tohex[last & 0xf];
-					sofar += 3;
-				}
-			}
-			
-			if (is_qpsafe (c)) {
-				if (sofar > 74) {
-					*outptr++ = '=';
-					*outptr++ = '\n';
-					sofar = 0;
-				}
-				
-				/* delay output of space char */
-				if (is_blank (c)) {
-					last = c;
-				} else {
-					*outptr++ = c;
-					sofar++;
-					last = -1;
-				}
-			} else {
-				if (sofar > 72) {
-					*outptr++ = '=';
-					*outptr++ = '\n';
-					sofar = 3;
-				} else
-					sofar += 3;
-				
-				*outptr++ = '=';
-				*outptr++ = tohex[(c >> 4) & 0xf];
-				*outptr++ = tohex[c & 0xf];
-				last = -1;
-			}
-		}
-	}
-	
-	*save = sofar;
-	*state = last;
-	
-	return (outptr - outbuf);
-}
-
-
-/**
- * g_mime_utils_quoted_decode_step:
- * @inbuf: input buffer
- * @inlen: input buffer length
- * @outbuf: output buffer
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a block of quoted-printable encoded data. Performs a
- * 'decode step' on a chunk of QP encoded data.
- *
- * Returns the number of bytes decoded.
- **/
-size_t
-g_mime_utils_quoted_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save)
-{
-	/* FIXME: this does not strip trailing spaces from lines (as
-	 * it should, rfc 2045, section 6.7) Should it also
-	 * canonicalise the end of line to CR LF??
-	 *
-	 * Note: Trailing rubbish (at the end of input), like = or =x
-	 * or =\r will be lost.
-	 */
-	const register unsigned char *inptr = inbuf;
-	const unsigned char *inend = inbuf + inlen;
-	register unsigned char *outptr = outbuf;
-	guint32 isave = *save;
-	int istate = *state;
-	unsigned char c;
-	
-	d(printf ("quoted-printable, decoding text '%.*s'\n", inlen, inbuf));
-	
-	while (inptr < inend) {
-		switch (istate) {
-		case 0:
-			while (inptr < inend) {
-				c = *inptr++;
-				/* FIXME: use a specials table to avoid 3 comparisons for the common case */
-				if (c == '=') { 
-					istate = 1;
-					break;
-				}
-#ifdef CANONICALISE_EOL
-				/*else if (c=='\r') {
-					state = 3;
-				} else if (c=='\n') {
-					*outptr++ = '\r';
-					*outptr++ = c;
-					} */
-#endif
-				else {
-					*outptr++ = c;
-				}
-			}
-			break;
-		case 1:
-			c = *inptr++;
-			if (c == '\n') {
-				/* soft break ... unix end of line */
-				istate = 0;
-			} else {
-				isave = c;
-				istate = 2;
-			}
-			break;
-		case 2:
-			c = *inptr++;
-			if (isxdigit (c) && isxdigit (isave)) {
-				c = toupper ((int) c);
-				isave = toupper ((int) isave);
-				*outptr++ = (((isave >= 'A' ? isave - 'A' + 10 : isave - '0') & 0x0f) << 4)
-					| ((c >= 'A' ? c - 'A' + 10 : c - '0') & 0x0f);
-			} else if (c == '\n' && isave == '\r') {
-				/* soft break ... canonical end of line */
-			} else {
-				/* just output the data */
-				*outptr++ = '=';
-				*outptr++ = isave;
-				*outptr++ = c;
-			}
-			istate = 0;
-			break;
-#ifdef CANONICALISE_EOL
-		case 3:
-			/* convert \n -> to \r\n, leaves \r\n alone */
-			c = *inptr++;
-			if (c == '\n') {
-				*outptr++ = '\r';
-				*outptr++ = c;
-			} else {
-				*outptr++ = '\r';
-				*outptr++ = '\n';
-				*outptr++ = c;
-			}
-			istate = 0;
-			break;
-#endif
-		}
-	}
-	
-	*state = istate;
-	*save = isave;
-	
-	return (outptr - outbuf);
-}

Modified: trunk/gmime/gmime-utils.h
==============================================================================
--- trunk/gmime/gmime-utils.h	(original)
+++ trunk/gmime/gmime-utils.h	Thu May 29 02:25:42 2008
@@ -26,33 +26,9 @@
 #include <time.h>
 #include <stdarg.h>
 
-G_BEGIN_DECLS
-
-
-/**
- * GMimePartEncodingType:
- * @GMIME_PART_ENCODING_DEFAULT: Default transfer encoding.
- * @GMIME_PART_ENCODING_7BIT: 7bit text transfer encoding.
- * @GMIME_PART_ENCODING_8BIT: 8bit text transfer encoding.
- * @GMIME_PART_ENCODING_BINARY: Binary transfer encoding.
- * @GMIME_PART_ENCODING_BASE64: Base64 transfer encoding.
- * @GMIME_PART_ENCODING_QUOTEDPRINTABLE: Quoted-printable transfer encoding.
- * @GMIME_PART_ENCODING_UUENCODE: Uuencode transfer encoding.
- * @GMIME_PART_NUM_ENCODINGS: The number of available transfer encoding enum values.
- *
- * A Content-Transfer-Encoding type.
- **/
-typedef enum {
-	GMIME_PART_ENCODING_DEFAULT,
-	GMIME_PART_ENCODING_7BIT,
-	GMIME_PART_ENCODING_8BIT,
-	GMIME_PART_ENCODING_BINARY,
-	GMIME_PART_ENCODING_BASE64,
-	GMIME_PART_ENCODING_QUOTEDPRINTABLE,
-	GMIME_PART_ENCODING_UUENCODE,
-	GMIME_PART_NUM_ENCODINGS
-} GMimePartEncodingType;
+#include <gmime/gmime-encodings.h>
 
+G_BEGIN_DECLS
 
 typedef struct _GMimeReferences GMimeReferences;
 
@@ -70,71 +46,6 @@
 };
 
 
-/**
- * GMIME_BASE64_ENCODE_LEN:
- * @x: Length of the input data to encode
- *
- * Calculates the maximum number of bytes needed to base64 encode the
- * full input buffer of length @x.
- *
- * Returns the number of output bytes needed to base64 encode an input
- * buffer of size @x.
- **/
-#define GMIME_BASE64_ENCODE_LEN(x) ((size_t) (((((x) + 2) / 57) * 77) + 77))
-
-
-/**
- * GMIME_QP_ENCODE_LEN:
- * @x: Length of the input data to encode
- *
- * Calculates the maximum number of bytes needed to encode the full
- * input buffer of length @x using the quoted-printable encoding.
- *
- * Returns the number of output bytes needed to encode an input buffer
- * of size @x using the quoted-printable encoding.
- **/
-#define GMIME_QP_ENCODE_LEN(x)     ((size_t) (((x) + 1) * 3))
-
-
-/**
- * GMIME_UUENCODE_LEN:
- * @x: Length of the input data to encode
- *
- * Calculates the maximum number of bytes needed to uuencode the full
- * input buffer of length @x.
- *
- * Returns the number of output bytes needed to uuencode an input
- * buffer of size @x.
- **/
-#define GMIME_UUENCODE_LEN(x)      ((size_t) (((((x) + 2) / 45) * 62) + 62))
-
-
-/**
- * GMIME_UUDECODE_STATE_INIT:
- *
- * Initial state for the g_mime_utils_uudecode_step() function.
- **/
-#define GMIME_UUDECODE_STATE_INIT   (0)
-
-
-/**
- * GMIME_UUDECODE_STATE_BEGIN:
- *
- * State for the g_mime_utils_uudecode_step() function, denoting that
- * the 'begin' line has been found.
- **/
-#define GMIME_UUDECODE_STATE_BEGIN  (1 << 16)
-
-
-/**
- * GMIME_UUDECODE_STATE_END:
- *
- * State for the g_mime_utils_uudecode_step() function, denoting that
- * the end of the UU encoded block has been found.
- **/
-#define GMIME_UUDECODE_STATE_END    (1 << 17)
-#define GMIME_UUDECODE_STATE_MASK   (GMIME_UUDECODE_STATE_BEGIN | GMIME_UUDECODE_STATE_END)
-
 time_t g_mime_utils_header_decode_date (const char *str, int *tz_offset);
 char  *g_mime_utils_header_format_date (time_t date, int tz_offset);
 
@@ -147,6 +58,7 @@
 GMimeReferences *g_mime_references_decode (const char *text);
 void g_mime_references_append (GMimeReferences **refs, const char *msgid);
 void g_mime_references_clear (GMimeReferences **refs);
+void g_mime_references_free (GMimeReferences *refs);
 const GMimeReferences *g_mime_references_get_next (const GMimeReferences *ref);
 const char *g_mime_references_get_message_id (const GMimeReferences *ref);
 
@@ -160,7 +72,7 @@
 
 /* encoding decision making utilities ;-) */
 gboolean g_mime_utils_text_is_8bit (const unsigned char *text, size_t len);
-GMimePartEncodingType g_mime_utils_best_encoding (const unsigned char *text, size_t len);
+GMimeContentEncoding g_mime_utils_best_encoding (const unsigned char *text, size_t len);
 
 /* utility function to convert text in an unknown 8bit/multibyte charset to UTF-8 */
 char *g_mime_utils_decode_8bit (const char *text, size_t len);
@@ -172,22 +84,6 @@
 char *g_mime_utils_header_decode_phrase (const char *phrase);
 char *g_mime_utils_header_encode_phrase (const char *phrase);
 
-/* do incremental base64 (de/en)coding */
-size_t g_mime_utils_base64_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-size_t g_mime_utils_base64_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-size_t g_mime_utils_base64_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-
-/* do incremental uu (de/en)coding */
-size_t g_mime_utils_uudecode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-size_t g_mime_utils_uuencode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save);
-size_t g_mime_utils_uuencode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save);
-
-/* do incremental quoted-printable (de/en)coding */
-size_t g_mime_utils_quoted_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-size_t g_mime_utils_quoted_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-size_t g_mime_utils_quoted_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
-
-
 G_END_DECLS
 
 #endif /* __GMIME_UTILS_H__ */

Modified: trunk/gmime/gmime.h
==============================================================================
--- trunk/gmime/gmime.h	(original)
+++ trunk/gmime/gmime.h	Thu May 29 02:25:42 2008
@@ -40,6 +40,7 @@
 #include <gmime/gmime-message-part.h>
 #include <gmime/gmime-message-partial.h>
 #include <gmime/internet-address.h>
+#include <gmime/gmime-encodings.h>
 #include <gmime/gmime-parser.h>
 #include <gmime/gmime-utils.h>
 #include <gmime/gmime-stream.h>

Modified: trunk/mono/DataWrapper.custom
==============================================================================
--- trunk/mono/DataWrapper.custom	(original)
+++ trunk/mono/DataWrapper.custom	Thu May 29 02:25:42 2008
@@ -1,35 +1,25 @@
 public StreamWrapper Stream {
 	get {
 		GMime.Stream gmime_stream = GMimeStream;
-		GMime.StreamFilter filtered_stream = new GMime.StreamFilter (gmime_stream);
-		gmime_stream.Dispose ();
-
+		GMime.StreamFilter filtered_stream;
 		FilterBasic filter;
 
 		switch (Encoding) {
+		case ContentEncoding.QuotedPrintable:
+		case ContentEncoding.UuEncode:
+		case ContentEncoding.Base64:
+			filtered_stream = new GMime.StreamFilter (gmime_stream);
+			filter = new FilterBasic (Encoding, false);
+			filtered_stream.Add (filter);
+			gmime_stream.Dispose ();
+			filter.Dispose ();
 
-		case PartEncodingType.Base64:
-			filter = new FilterBasic (FilterBasicType.Base64Decode);
-			break;
-
-		case PartEncodingType.QuotedPrintable:
-			filter = new FilterBasic (FilterBasicType.QpDecode);
-			break;
-
-		case PartEncodingType.UuEncode:
-			filter = new FilterBasic (FilterBasicType.UuDecode);
+			gmime_stream = filtered_stream;
 			break;
-
 		default:
-			filter = null;
 			break;
 		}
 
-		if (filter != null) {
-			filtered_stream.Add (filter);
-			filter.Dispose ();
-		}
-
-		return new StreamWrapper (filtered_stream);
+		return new StreamWrapper (gmime_stream);
 	}
 }

Modified: trunk/mono/GMime.metadata
==============================================================================
--- trunk/mono/GMime.metadata	(original)
+++ trunk/mono/GMime.metadata	Thu May 29 02:25:42 2008
@@ -22,6 +22,15 @@
   <attr path="/api/namespace/enum/member[ cname='GMIME_PART_ENCODING_UUENCODE']" name="name">UuEncode</attr>
   <attr path="/api/namespace/enum/member[ cname='GMIME_PART_NUM_ENCODINGS']" name="hidden">true</attr>
 
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_DEFAULT']" name="name">Default</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_7BIT']" name="name">SevenBit</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_8BIT']" name="name">EightBit</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_BINARY']" name="name">Binary</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_BASE64']" name="name">Base64</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE']" name="name">QuotedPrintable</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_UUENCODE']" name="name">UuEncode</attr>
+  <attr path="/api/namespace/enum/member[ cname='GMIME_CONTENT_ENCODING_COUNT']" name="hidden">true</attr>
+
   <attr path="/api/namespace/enum/member[ cname='GMIME_FILTER_BASIC_BASE64_ENC']" name="name">Base64Encode</attr>
   <attr path="/api/namespace/enum/member[ cname='GMIME_FILTER_BASIC_BASE64_DEC']" name="name">Base64Decode</attr>
   <attr path="/api/namespace/enum/member[ cname='GMIME_FILTER_BASIC_QP_ENC']" name="name">QpEncode</attr>

Modified: trunk/mono/gmime-api.raw
==============================================================================
--- trunk/mono/gmime-api.raw	(original)
+++ trunk/mono/gmime-api.raw	Thu May 29 02:25:42 2008
@@ -21,13 +21,15 @@
       <member cname="GMIME_CIPHER_HASH_TIGER192" name="Tiger192" />
       <member cname="GMIME_CIPHER_HASH_HAVAL5160" name="Haval5160" />
     </enum>
-    <enum name="FilterBasicType" cname="GMimeFilterBasicType" type="enum">
-      <member cname="GMIME_FILTER_BASIC_BASE64_ENC" name="Base64Enc" value="1" />
-      <member cname="GMIME_FILTER_BASIC_BASE64_DEC" name="Base64Dec" />
-      <member cname="GMIME_FILTER_BASIC_QP_ENC" name="QpEnc" />
-      <member cname="GMIME_FILTER_BASIC_QP_DEC" name="QpDec" />
-      <member cname="GMIME_FILTER_BASIC_UU_ENC" name="UuEnc" />
-      <member cname="GMIME_FILTER_BASIC_UU_DEC" name="UuDec" />
+    <enum name="ContentEncoding" cname="GMimeContentEncoding" type="enum">
+      <member cname="GMIME_CONTENT_ENCODING_DEFAULT" name="Default" />
+      <member cname="GMIME_CONTENT_ENCODING_7BIT" name="7Bit" />
+      <member cname="GMIME_CONTENT_ENCODING_8BIT" name="8Bit" />
+      <member cname="GMIME_CONTENT_ENCODING_BINARY" name="Binary" />
+      <member cname="GMIME_CONTENT_ENCODING_BASE64" name="Base64" />
+      <member cname="GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE" name="Quotedprintable" />
+      <member cname="GMIME_CONTENT_ENCODING_UUENCODE" name="Uuencode" />
+      <member cname="GMIME_CONTENT_ENCODING_COUNT" name="Count" />
     </enum>
     <enum name="FilterCRLFDirection" cname="GMimeFilterCRLFDirection" type="enum">
       <member cname="GMIME_FILTER_CRLF_ENCODE" name="Encode" />
@@ -50,16 +52,6 @@
       <member cname="GMIME_FILTER_YENC_DIRECTION_ENCODE" name="Encode" />
       <member cname="GMIME_FILTER_YENC_DIRECTION_DECODE" name="Decode" />
     </enum>
-    <enum name="PartEncodingType" cname="GMimePartEncodingType" type="enum">
-      <member cname="GMIME_PART_ENCODING_DEFAULT" name="EncodingDefault" />
-      <member cname="GMIME_PART_ENCODING_7BIT" name="Encoding7bit" />
-      <member cname="GMIME_PART_ENCODING_8BIT" name="Encoding8bit" />
-      <member cname="GMIME_PART_ENCODING_BINARY" name="EncodingBinary" />
-      <member cname="GMIME_PART_ENCODING_BASE64" name="EncodingBase64" />
-      <member cname="GMIME_PART_ENCODING_QUOTEDPRINTABLE" name="EncodingQuotedprintable" />
-      <member cname="GMIME_PART_ENCODING_UUENCODE" name="EncodingUuencode" />
-      <member cname="GMIME_PART_NUM_ENCODINGS" name="NumEncodings" />
-    </enum>
     <enum name="SeekWhence" cname="GMimeSeekWhence" type="enum">
       <member cname="GMIME_STREAM_SEEK_SET" name="Set" value="SEEK_SET" />
       <member cname="GMIME_STREAM_SEEK_CUR" name="Cur" value="SEEK_CUR" />
@@ -300,7 +292,7 @@
       </method>
     </object>
     <object name="DataWrapper" cname="GMimeDataWrapper" parent="GObject">
-      <field name="Encoding" cname="encoding" type="GMimePartEncodingType" />
+      <field name="Encoding" cname="encoding" type="GMimeContentEncoding" />
       <field name="Stream" cname="stream" type="GMimeStream*" />
       <virtual_method name="WriteToStream" cname="write_to_stream">
         <return-type type="ssize_t" />
@@ -310,7 +302,7 @@
         </parameters>
       </virtual_method>
       <method name="GetEncoding" cname="g_mime_data_wrapper_get_encoding">
-        <return-type type="GMimePartEncodingType" />
+        <return-type type="GMimeContentEncoding" />
       </method>
       <method name="GetStream" cname="g_mime_data_wrapper_get_stream">
         <return-type type="GMimeStream*" />
@@ -322,13 +314,13 @@
       <constructor cname="g_mime_data_wrapper_new_with_stream">
         <parameters>
           <parameter type="GMimeStream*" name="stream" />
-          <parameter type="GMimePartEncodingType" name="encoding" />
+          <parameter type="GMimeContentEncoding" name="encoding" />
         </parameters>
       </constructor>
       <method name="SetEncoding" cname="g_mime_data_wrapper_set_encoding">
         <return-type type="void" />
         <parameters>
-          <parameter type="GMimePartEncodingType" name="encoding" />
+          <parameter type="GMimeContentEncoding" name="encoding" />
         </parameters>
       </method>
       <method name="SetStream" cname="g_mime_data_wrapper_set_stream">
@@ -437,16 +429,14 @@
       </method>
     </object>
     <object name="FilterBasic" cname="GMimeFilterBasic" parent="GMimeFilter">
-      <field name="Type" cname="type" type="GMimeFilterBasicType" />
-      <field name="Uubuf" cname="uubuf" array_len="60" type="unsigned char" />
-      <field name="Save" cname="save" type="guint32" />
-      <field name="State" cname="state" type="int" />
+      <field name="Encoder" cname="encoder" type="GMimeEncoding" />
       <method name="GetType" cname="g_mime_filter_basic_get_type" shared="true">
         <return-type type="GType" />
       </method>
-      <constructor cname="g_mime_filter_basic_new_type">
+      <constructor cname="g_mime_filter_basic_new">
         <parameters>
-          <parameter type="GMimeFilterBasicType" name="type" />
+          <parameter type="GMimeContentEncoding" name="encoding" />
+          <parameter type="gboolean" name="encode" />
         </parameters>
       </constructor>
     </object>
@@ -467,7 +457,7 @@
         <return-type type="const-char*" />
       </method>
       <method name="Encoding" cname="g_mime_filter_best_encoding">
-        <return-type type="GMimePartEncodingType" />
+        <return-type type="GMimeContentEncoding" />
         <parameters>
           <parameter type="GMimeBestEncoding" name="required" />
         </parameters>
@@ -1286,26 +1276,17 @@
       </method>
     </object>
     <object name="Part" cname="GMimePart" parent="GMimeObject">
-      <field name="Encoding" cname="encoding" type="GMimePartEncodingType" />
+      <field name="Encoding" cname="encoding" type="GMimeContentEncoding" />
       <field name="ContentDescription" cname="content_description" type="char*" />
       <field name="ContentLocation" cname="content_location" type="char*" />
       <field name="ContentMd5" cname="content_md5" type="char*" />
       <field name="Content" cname="content" type="GMimeDataWrapper*" />
-      <method name="EncodingFromString" cname="g_mime_part_encoding_from_string" shared="true">
-        <return-type type="GMimePartEncodingType" />
-        <parameters>
-          <parameter type="const-char*" name="encoding" />
-        </parameters>
-      </method>
-      <method name="EncodingToString" cname="g_mime_part_encoding_to_string" shared="true">
-        <return-type type="const-char*" />
-        <parameters>
-          <parameter type="GMimePartEncodingType" name="encoding" />
-        </parameters>
-      </method>
       <method name="GetContentDescription" cname="g_mime_part_get_content_description">
         <return-type type="const-char*" />
       </method>
+      <method name="GetContentEncoding" cname="g_mime_part_get_content_encoding">
+        <return-type type="GMimeContentEncoding" />
+      </method>
       <method name="GetContentHeader" cname="g_mime_part_get_content_header">
         <return-type type="const-char*" />
         <parameters>
@@ -1324,9 +1305,6 @@
       <method name="GetContentObject" cname="g_mime_part_get_content_object">
         <return-type type="GMimeDataWrapper*" />
       </method>
-      <method name="GetEncoding" cname="g_mime_part_get_encoding">
-        <return-type type="GMimePartEncodingType" />
-      </method>
       <method name="GetFilename" cname="g_mime_part_get_filename">
         <return-type type="const-char*" />
       </method>
@@ -1346,6 +1324,12 @@
           <parameter type="const-char*" name="description" />
         </parameters>
       </method>
+      <method name="SetContentEncoding" cname="g_mime_part_set_content_encoding">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="GMimeContentEncoding" name="encoding" />
+        </parameters>
+      </method>
       <method name="SetContentHeader" cname="g_mime_part_set_content_header">
         <return-type type="void" />
         <parameters>
@@ -1377,12 +1361,6 @@
           <parameter type="GMimeDataWrapper*" name="content" />
         </parameters>
       </method>
-      <method name="SetEncoding" cname="g_mime_part_set_encoding">
-        <return-type type="void" />
-        <parameters>
-          <parameter type="GMimePartEncodingType" name="encoding" />
-        </parameters>
-      </method>
       <method name="SetFilename" cname="g_mime_part_set_filename">
         <return-type type="void" />
         <parameters>
@@ -1996,6 +1974,137 @@
         <return-type type="char*" />
       </method>
     </struct>
+    <struct name="Encoding" cname="GMimeEncoding" opaque="true">
+      <method name="Base64DecodeStep" cname="g_mime_encoding_base64_decode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="Base64EncodeClose" cname="g_mime_encoding_base64_encode_close" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="Base64EncodeStep" cname="g_mime_encoding_base64_encode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="Flush" cname="g_mime_encoding_flush">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="char*" name="outbuf" />
+        </parameters>
+      </method>
+      <method name="InitDecode" cname="g_mime_encoding_init_decode">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="GMimeContentEncoding" name="encoding" />
+        </parameters>
+      </method>
+      <method name="InitEncode" cname="g_mime_encoding_init_encode">
+        <return-type type="void" />
+        <parameters>
+          <parameter type="GMimeContentEncoding" name="encoding" />
+        </parameters>
+      </method>
+      <method name="Outlen" cname="g_mime_encoding_outlen">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="size_t" name="inlen" />
+        </parameters>
+      </method>
+      <method name="QuotedDecodeStep" cname="g_mime_encoding_quoted_decode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="QuotedEncodeClose" cname="g_mime_encoding_quoted_encode_close" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="QuotedEncodeStep" cname="g_mime_encoding_quoted_encode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="Reset" cname="g_mime_encoding_reset">
+        <return-type type="void" />
+      </method>
+      <method name="Step" cname="g_mime_encoding_step">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="char*" name="outbuf" />
+        </parameters>
+      </method>
+      <method name="UudecodeStep" cname="g_mime_encoding_uudecode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="UuencodeClose" cname="g_mime_encoding_uuencode_close" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="unsigned-char*" name="uubuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+      <method name="UuencodeStep" cname="g_mime_encoding_uuencode_step" shared="true">
+        <return-type type="size_t" />
+        <parameters>
+          <parameter type="const-unsigned-char*" name="inbuf" />
+          <parameter type="size_t" name="inlen" />
+          <parameter type="unsigned-char*" name="outbuf" />
+          <parameter type="unsigned-char*" name="uubuf" />
+          <parameter type="int*" name="state" />
+          <parameter type="guint32*" name="save" />
+        </parameters>
+      </method>
+    </struct>
     <struct name="Header" cname="GMimeHeader" opaque="true">
       <method name="Add" cname="g_mime_header_add">
         <return-type type="void" />
@@ -2124,6 +2233,9 @@
           <parameter type="const-char*" name="text" />
         </parameters>
       </method>
+      <method name="Free" cname="g_mime_references_free">
+        <return-type type="void" />
+      </method>
       <method name="GetMessageId" cname="g_mime_references_get_message_id">
         <return-type type="const-char*" />
       </method>
@@ -2326,15 +2438,29 @@
       <method name="YdecodeStep" cname="g_mime_ydecode_step" shared="true">
         <return-type type="size_t" />
         <parameters>
-          <parameter type="const-unsigned-char*" name="in" />
+          <parameter type="const-unsigned-char*" name="inbuf" />
           <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="out" />
+          <parameter type="unsigned-char*" name="outbuf" />
           <parameter type="int*" name="state" />
           <parameter type="guint32*" name="pcrc" />
           <parameter type="guint32*" name="crc" />
         </parameters>
       </method>
     </class>
+    <class name="Content" cname="GMimeContent_">
+      <method name="EncodingFromString" cname="g_mime_content_encoding_from_string" shared="true">
+        <return-type type="GMimeContentEncoding" />
+        <parameters>
+          <parameter type="const-char*" name="str" />
+        </parameters>
+      </method>
+      <method name="EncodingToString" cname="g_mime_content_encoding_to_string" shared="true">
+        <return-type type="const-char*" />
+        <parameters>
+          <parameter type="GMimeContentEncoding" name="encoding" />
+        </parameters>
+      </method>
+    </class>
     <class name="Decode" cname="GMimeDecode_">
       <method name="Domain" cname="g_mime_decode_domain" shared="true">
         <return-type type="char*" />
@@ -2441,38 +2567,8 @@
       </method>
     </class>
     <class name="Utils" cname="GMimeUtils_">
-      <method name="Base64DecodeStep" cname="g_mime_utils_base64_decode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="Base64EncodeClose" cname="g_mime_utils_base64_encode_close" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="Base64EncodeStep" cname="g_mime_utils_base64_encode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
       <method name="BestEncoding" cname="g_mime_utils_best_encoding" shared="true">
-        <return-type type="GMimePartEncodingType" />
+        <return-type type="GMimeContentEncoding" />
         <parameters>
           <parameter type="const-unsigned-char*" name="text" />
           <parameter type="size_t" name="len" />
@@ -2554,36 +2650,6 @@
           <parameter type="const-char*" name="str" />
         </parameters>
       </method>
-      <method name="QuotedDecodeStep" cname="g_mime_utils_quoted_decode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="QuotedEncodeClose" cname="g_mime_utils_quoted_encode_close" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="QuotedEncodeStep" cname="g_mime_utils_quoted_encode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
       <method name="StructuredHeaderFold" cname="g_mime_utils_structured_header_fold" shared="true">
         <return-type type="char*" />
         <parameters>
@@ -2609,46 +2675,14 @@
           <parameter type="const-char*" name="str" />
         </parameters>
       </method>
-      <method name="UudecodeStep" cname="g_mime_utils_uudecode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="UuencodeClose" cname="g_mime_utils_uuencode_close" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="unsigned-char*" name="uubuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
-      <method name="UuencodeStep" cname="g_mime_utils_uuencode_step" shared="true">
-        <return-type type="size_t" />
-        <parameters>
-          <parameter type="const-unsigned-char*" name="inbuf" />
-          <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="outbuf" />
-          <parameter type="unsigned-char*" name="uubuf" />
-          <parameter type="int*" name="state" />
-          <parameter type="guint32*" name="save" />
-        </parameters>
-      </method>
     </class>
     <class name="Yencode" cname="GMimeYencode_">
       <method name="Close" cname="g_mime_yencode_close" shared="true">
         <return-type type="size_t" />
         <parameters>
-          <parameter type="const-unsigned-char*" name="in" />
+          <parameter type="const-unsigned-char*" name="inbuf" />
           <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="out" />
+          <parameter type="unsigned-char*" name="outbuf" />
           <parameter type="int*" name="state" />
           <parameter type="guint32*" name="pcrc" />
           <parameter type="guint32*" name="crc" />
@@ -2657,9 +2691,9 @@
       <method name="Step" cname="g_mime_yencode_step" shared="true">
         <return-type type="size_t" />
         <parameters>
-          <parameter type="const-unsigned-char*" name="in" />
+          <parameter type="const-unsigned-char*" name="inbuf" />
           <parameter type="size_t" name="inlen" />
-          <parameter type="unsigned-char*" name="out" />
+          <parameter type="unsigned-char*" name="outbuf" />
           <parameter type="int*" name="state" />
           <parameter type="guint32*" name="pcrc" />
           <parameter type="guint32*" name="crc" />

Modified: trunk/src/uudecode.c
==============================================================================
--- trunk/src/uudecode.c	(original)
+++ trunk/src/uudecode.c	Thu May 29 02:25:42 2008
@@ -88,7 +88,7 @@
 uudecode (const char *progname, int argc, char **argv)
 {
 	GMimeStream *istream, *ostream, *fstream;
-	GMimeFilterBasicType encoding;
+	GMimeContentEncoding encoding;
 	int fd, opt, longindex = 0;
 	register const char *p;
 	char inbuf[4096], *q;
@@ -135,11 +135,11 @@
 		p = NULL;
 		while ((fgets (inbuf, sizeof (inbuf), fp)) != NULL) {
 			if (!strncmp (inbuf, "begin-base64 ", 13)) {
-				encoding = GMIME_FILTER_BASIC_BASE64_DEC;
+				encoding = GMIME_CONTENT_ENCODING_BASE64;
 				p = inbuf + 13;
 				break;
 			} else if (!strncmp (inbuf, "begin ", 6)) {
-				encoding = GMIME_FILTER_BASIC_UU_DEC;
+				encoding = GMIME_CONTENT_ENCODING_UUENCODE;
 				p = inbuf + 6;
 				break;
 			}
@@ -202,14 +202,14 @@
 		istream = g_mime_stream_file_new (fp);
 		ostream = g_mime_stream_fs_new (fd);
 		fstream = g_mime_stream_filter_new_with_stream (ostream);
-		filter = g_mime_filter_basic_new_type (encoding);
+		filter = g_mime_filter_basic_new (encoding, FALSE);
 		g_mime_stream_filter_add ((GMimeStreamFilter *) fstream, filter);
 		g_object_unref (ostream);
 		g_object_unref (filter);
 		
-		if (encoding == GMIME_FILTER_BASIC_UU_DEC) {
+		if (encoding == GMIME_CONTENT_ENCODING_UUENCODE) {
 			/* Tell the filter that we've already read past the begin line */
-			((GMimeFilterBasic *) filter)->state |= GMIME_UUDECODE_STATE_BEGIN;
+			((GMimeFilterBasic *) filter)->encoder.state |= GMIME_UUDECODE_STATE_BEGIN;
 		}
 		
 		if (g_mime_stream_write_to_stream (istream, fstream) == -1) {

Modified: trunk/src/uuencode.c
==============================================================================
--- trunk/src/uuencode.c	(original)
+++ trunk/src/uuencode.c	Thu May 29 02:25:42 2008
@@ -99,7 +99,7 @@
 uuencode (const char *progname, int argc, char **argv)
 {
 	GMimeStream *istream, *ostream, *fstream;
-	GMimeFilterBasicType encoding;
+	GMimeContentEncoding encoding;
 	const char *filename, *name;
 	GMimeFilter *filter;
 	gboolean base64;
@@ -107,7 +107,7 @@
 	int fd, opt;
 	
 	base64 = FALSE;
-	encoding = GMIME_FILTER_BASIC_UU_ENC;
+	encoding = GMIME_CONTENT_ENCODING_UUENCODE;
 	while ((opt = getopt_long (argc, argv, "hvm", longopts, NULL)) != -1) {
 		switch (opt) {
 		case 'h':
@@ -118,7 +118,7 @@
 			return 0;
 		case 'm':
 			base64 = TRUE;
-			encoding = GMIME_FILTER_BASIC_BASE64_ENC;
+			encoding = GMIME_CONTENT_ENCODING_BASE64;
 			break;
 		default:
 			printf ("Try `%s --help' for more information.\n", progname);
@@ -173,7 +173,7 @@
 	
 	fstream = g_mime_stream_filter_new_with_stream (ostream);
 	
-	filter = g_mime_filter_basic_new_type (encoding);
+	filter = g_mime_filter_basic_new (encoding, TRUE);
 	g_mime_stream_filter_add ((GMimeStreamFilter *) fstream, filter);
 	g_object_unref (filter);
 	

Modified: trunk/tests/test-best.c
==============================================================================
--- trunk/tests/test-best.c	(original)
+++ trunk/tests/test-best.c	Thu May 29 02:25:42 2008
@@ -56,13 +56,13 @@
 	printf ("summary for %s:\n", argv[1]);
 	printf ("\tbest charset: %s\n", g_mime_filter_best_charset (best));
 	printf ("\tbest encoding (7bit): %s\n",
-		g_mime_part_encoding_to_string (
+		g_mime_content_encoding_to_string (
 			g_mime_filter_best_encoding (best, GMIME_BEST_ENCODING_7BIT)));
 	printf ("\tbest encoding (8bit): %s\n",
-		g_mime_part_encoding_to_string (
+		g_mime_content_encoding_to_string (
 			g_mime_filter_best_encoding (best, GMIME_BEST_ENCODING_8BIT)));
 	printf ("\tbest encoding (binary): %s\n",
-		g_mime_part_encoding_to_string (
+		g_mime_content_encoding_to_string (
 			g_mime_filter_best_encoding (best, GMIME_BEST_ENCODING_BINARY)));
 	
 	g_object_unref (istream);

Modified: trunk/tests/test-pgpmime.c
==============================================================================
--- trunk/tests/test-pgpmime.c	(original)
+++ trunk/tests/test-pgpmime.c	Thu May 29 02:25:42 2008
@@ -224,7 +224,7 @@
 	
 	part = g_mime_part_new ();
 	content_type = g_mime_content_type_new ("text", "plain");
-	g_mime_part_set_content_type (part, content_type);
+	g_mime_object_set_content_type ((GMimeObject *) part, content_type);
 	
 	stream = g_mime_stream_mem_new ();
 	g_mime_stream_write_string (stream, MULTIPART_SIGNED_CONTENT);
@@ -238,7 +238,7 @@
 #endif
 	
 	g_mime_stream_reset (stream);
-	content = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
+	content = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
 	g_object_unref (stream);
 	
 	g_mime_part_set_content_object (part, content);
@@ -332,7 +332,7 @@
 	
 	part = g_mime_part_new ();
 	content_type = g_mime_content_type_new ("text", "plain");
-	g_mime_part_set_content_type (part, content_type);
+	g_mime_object_set_content_type ((GMimeObject *) part, content_type);
 	g_mime_part_set_content_object (part, content);
 	g_object_unref (content);
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]