Index: src/sendmsg-window.c
===================================================================
--- src/sendmsg-window.c	(revision 7940)
+++ src/sendmsg-window.c	(working copy)
@@ -1975,12 +1975,7 @@
 	if (!subject)
 	    headers->subject = g_strdup(_("(no subject)"));
 	else
-#if HAVE_GMIME_2_2_5
 	    headers->subject = g_mime_utils_header_decode_text(subject);
-#else  /* HAVE_GMIME_2_2_5 */
-	    headers->subject =
-		g_mime_utils_header_decode_text((guchar *) subject);
-#endif /* HAVE_GMIME_2_2_5 */
     }
     libbalsa_utf8_sanitize(&headers->subject,
 			   balsa_app.convert_unknown_8bit,
@@ -3368,7 +3363,7 @@
 
     gtk_tree_store_append(store, &iter, parent);
     if (body->mime_part)
-	disp_type = g_mime_part_get_content_disposition(GMIME_PART(body->mime_part));
+	disp_type = g_mime_object_get_disposition(body->mime_part);
     else
 	disp_type = NULL;
     preselect = !disp_type || *disp_type == '\0' ||
Index: configure.in
===================================================================
--- configure.in	(revision 7940)
+++ configure.in	(working copy)
@@ -307,7 +307,7 @@
 PKG_CHECK_MODULES(BALSA, [
 glib-2.0
 gtk+-2.0 >= 2.4
-gmime-2.0 >= 2.1.9
+gmime-2.4 >= 2.3.3
 $gnome_extras
 $gnome_print_extras
 ])
@@ -316,7 +316,7 @@
    libgnome-2.0 libgnomeui-2.0 
    glib-2.0
    gtk+-2.0 >= 2.4
-   gmime-2.0 >= 2.1.9
+   gmime-2.4 >= 2.3.3
 ])
 
 dnl ##########################################################################
@@ -863,16 +863,6 @@
 dnl things that it fixes, for eg. user installs, package builds etc.
 dnl AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache)
 
-dnl check GMime version
-if $PKG_CONFIG --atleast-version=2.2.5 gmime-2.0 ; then
-   AC_DEFINE(HAVE_GMIME_2_2_5,1,[Defined when GMime is at least version
-                                 2.2.5.])
-fi
-if $PKG_CONFIG --atleast-version=2.2.7 gmime-2.0 ; then
-   AC_DEFINE(HAVE_GMIME_2_2_7,1,[Defined when GMime is at least version
-                                 2.2.7.])
-fi
-
 dnl #####################################################################
 dnl 8. Output
 dnl #####################################################################
Index: libbalsa/mailbox_mh.c
===================================================================
--- libbalsa/mailbox_mh.c	(revision 7940)
+++ libbalsa/mailbox_mh.c	(working copy)
@@ -1094,9 +1094,9 @@
     }
     out_stream = g_mime_stream_fs_new(fd);
 
-    crlffilter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-                                        GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
-    in_stream = g_mime_stream_filter_new_with_stream(stream);
+    crlffilter = g_mime_filter_crlf_new(FALSE,
+                                        FALSE);
+    in_stream = g_mime_stream_filter_new(stream);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(in_stream), crlffilter);
     g_object_unref(crlffilter);
 
Index: libbalsa/mailbox_mbox.c
===================================================================
--- libbalsa/mailbox_mbox.c	(revision 7940)
+++ libbalsa/mailbox_mbox.c	(working copy)
@@ -1736,7 +1736,7 @@
 
     message = libbalsa_message_new();
 
-    header = g_mime_message_get_header (mime_message, "Status");
+    header = g_mime_object_get_header (GMIME_OBJECT(mime_message), "Status");
     if (header) {
 	if (strchr(header, 'R') == NULL) /* not found == not READ */
 	    flags |= LIBBALSA_MESSAGE_FLAG_NEW;
@@ -1746,7 +1746,7 @@
 	    flags |= LIBBALSA_MESSAGE_FLAG_RECENT;
     } else
 	    flags |= LIBBALSA_MESSAGE_FLAG_NEW |  LIBBALSA_MESSAGE_FLAG_RECENT;
-    header = g_mime_message_get_header (mime_message, "X-Status");
+    header = g_mime_object_get_header (GMIME_OBJECT(mime_message), "X-Status");
     if (header) {
 	if (strchr(header, 'D') != NULL) /* found == DELETED */
 	    flags |= LIBBALSA_MESSAGE_FLAG_DELETED;
@@ -1770,10 +1770,10 @@
     /* Create headers with spaces in place of flags, if necessary, so we
      * can later update them in place. */
     lbm_mbox_status_hdr(flags, 2, new_header);
-    g_mime_message_set_header(message, "Status", new_header->str);
+    g_mime_object_set_header(GMIME_OBJECT(message), "Status", new_header->str);
     g_string_truncate(new_header, 0);
     lbm_mbox_x_status_hdr(flags, 3, new_header);
-    g_mime_message_set_header(message, "X-Status", new_header->str);
+    g_mime_object_set_header(GMIME_OBJECT(message), "X-Status", new_header->str);
     g_string_free(new_header, TRUE);
 }
 
@@ -1801,11 +1801,11 @@
     else if (GMIME_IS_MESSAGE(mime_part))
         lbm_mbox_prepare_object(((GMimeMessage *) mime_part)->mime_part);
     else if (!GMIME_IS_MESSAGE_PARTIAL(mime_part)) {
-        GMimePartEncodingType encoding;
+        GMimeContentEncoding encoding;
         const GMimeContentType *mime_type;
 
-        encoding = g_mime_part_get_encoding(GMIME_PART(mime_part));
-        if (encoding == GMIME_PART_ENCODING_BASE64)
+        encoding = g_mime_part_get_content_encoding(GMIME_PART(mime_part));
+        if (encoding == GMIME_CONTENT_ENCODING_BASE64)
             return;
 
         mime_type = g_mime_object_get_content_type(mime_part);
@@ -1817,8 +1817,8 @@
                 return;
         }
 
-        g_mime_part_set_encoding(GMIME_PART(mime_part),
-                                 GMIME_PART_ENCODING_QUOTEDPRINTABLE);
+        g_mime_part_set_content_encoding(GMIME_PART(mime_part),
+                                 GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
     }
 }
 
@@ -1842,10 +1842,10 @@
     GMimeStream *fstream;
     GMimeFilter *filter;
     
-    fstream = g_mime_stream_filter_new_with_stream(stream);
+    fstream = g_mime_stream_filter_new(stream);
 
-    filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-				    GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+    filter = g_mime_filter_crlf_new(FALSE,
+				    FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(fstream), filter);
     g_object_unref(filter);
 
Index: libbalsa/message.c
===================================================================
--- libbalsa/message.c	(revision 7940)
+++ libbalsa/message.c	(working copy)
@@ -459,6 +459,8 @@
 GList *
 libbalsa_message_user_hdrs_from_gmime(GMimeMessage * message)
 {
+    GMimeHeaderList *hdrlist;
+    GMimeHeaderIter iter;
     GList *res = NULL;
     const char *value;
 
@@ -473,7 +475,7 @@
        already present in LibBalsaMessage::references field.  FWIW,
        mailbox driver does not copy references to user_headers.
     */
-    value = g_mime_message_get_header(message, "References");
+    value = g_mime_object_get_header(GMIME_OBJECT(message), "References");
     if (value) {
 #if BALSA_NEEDS_SEPARATE_USER_HEADERS
 	GMimeReferences *references, *reference;
@@ -496,26 +498,24 @@
 #endif
     }
 
-    value = g_mime_message_get_header(message, "In-Reply-To");
+    value = g_mime_object_get_header(GMIME_OBJECT(message), "In-Reply-To");
     if (value) {
         res =
-#if HAVE_GMIME_2_2_5
             g_list_prepend(res,
                            libbalsa_create_hdr_pair
                            ("In-Reply-To",
                             g_mime_utils_header_decode_text(value)));
-#else  /* HAVE_GMIME_2_2_5 */
-            g_list_prepend(res,
-                           libbalsa_create_hdr_pair
-                           ("In-Reply-To",
-                            g_mime_utils_header_decode_text
-                            ((unsigned char *) value)));
-#endif /* HAVE_GMIME_2_2_5 */
     }
 
-    g_mime_header_foreach(GMIME_OBJECT(message)->headers,
-			  prepend_header_misc, &res);
-
+    hdrlist = g_mime_object_get_header_list (GMIME_OBJECT(message));
+    if (g_mime_header_list_get_iter (hdrlist, &iter)) {
+	do {
+	    prepend_header_misc (g_mime_header_iter_get_name (&iter),
+				 g_mime_header_iter_get_value (&iter),
+				 &res);
+	} while (g_mime_header_iter_next (&iter));
+    }
+    
     return g_list_reverse(res);
 }
 
@@ -833,7 +833,7 @@
     const char *value;
     if (!msg->mime_msg)
 	return 0;
-    value = g_mime_message_get_header(msg->mime_msg, "Lines");
+    value = g_mime_object_get_header(msg->mime_msg, "Lines");
     if (!value)
 	return 0;
     return atoi(value);
@@ -845,7 +845,7 @@
     const char *value;
     if (!msg->mime_msg)
 	return 0;
-    value = g_mime_message_get_header(msg->mime_msg, "Content-Length");
+    value = g_mime_object_get_header(msg->mime_msg, "Content-Length");
     if (!value)
 	return 0;
     return atoi(value);
@@ -923,8 +923,8 @@
 
     if (!headers->dispnotify_to)
         headers->dispnotify_to =
-            internet_address_parse_string(g_mime_message_get_header
-                                          (mime_msg,
+            internet_address_parse_string(g_mime_object_get_header
+                                          (GMIME_OBJECT(mime_msg),
                                            "Disposition-Notification-To"));
 
     if (!headers->cc_list)
@@ -938,7 +938,7 @@
     /* Get fcc from message */
     if (!headers->fcc_url)
 	headers->fcc_url =
-	    g_strdup(g_mime_message_get_header(mime_msg, "X-Balsa-Fcc"));
+	    g_strdup(g_mime_object_get_header(GMIME_OBJECT(mime_msg), "X-Balsa-Fcc"));
 }
 
 /* Populate headers from the info in mime_msg. */
@@ -965,7 +965,7 @@
     header = g_mime_message_get_subject(mime_msg);
     libbalsa_message_set_subject_from_header(message, header);
 
-    header = g_mime_message_get_header(mime_msg, "Content-Length");
+    header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "Content-Length");
     if (header)
 	message->length = atoi(header);
 #endif
@@ -973,11 +973,11 @@
     if (header)
 	message->message_id = g_strdup(header);
 
-    header = g_mime_message_get_header(mime_msg, "References");
+    header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "References");
     if (header)
 	libbalsa_message_set_references_from_string(message, header);
 
-    header = g_mime_message_get_header(mime_msg, "In-Reply-To");
+    header = g_mime_object_get_header(GMIME_OBJECT(mime_msg), "In-Reply-To");
     if (header)
 	libbalsa_message_set_in_reply_to_from_string(message, header);
 
@@ -1086,11 +1086,7 @@
          * appropriate GMime decoder. */
         gchar *tmp = g_strdup(value);
         libbalsa_utf8_sanitize(&tmp, TRUE, NULL);
-#if HAVE_GMIME_2_2_5
         val = g_mime_utils_header_encode_text(tmp);
-#else  /* HAVE_GMIME_2_2_5 */
-        val = g_mime_utils_header_encode_text((unsigned char *) tmp);
-#endif /* HAVE_GMIME_2_2_5 */
         g_free(tmp);
 #ifdef DEBUG
         g_print("%s: non-ascii \"%s\" header \"%s\" encoded as \"%s\"\n",
@@ -1206,11 +1202,11 @@
      * fields, and finding the empty line that separates the body from
      * the header is simpler if it has no '\r' in it. */
     gmime_stream_filter =
-        g_mime_stream_filter_new_with_stream(gmime_stream);
+        g_mime_stream_filter_new(gmime_stream);
 
     gmime_filter_crlf =
-        g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-                               GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+        g_mime_filter_crlf_new(FALSE,
+                               FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(gmime_stream_filter),
                                                  gmime_filter_crlf);
     g_object_unref(gmime_filter_crlf);
@@ -1340,12 +1336,7 @@
 {
     if (header) {
         gchar *subject =
-#if HAVE_GMIME_2_2_5
             g_mime_utils_header_decode_text(header);
-#else  /* HAVE_GMIME_2_2_5 */
-            g_mime_utils_header_decode_text((const unsigned char *)
-                                            header);
-#endif /* HAVE_GMIME_2_2_5 */
         libbalsa_message_set_subject(message, subject);
         g_free(subject);
     }
Index: libbalsa/mime-stream-shared.c
===================================================================
--- libbalsa/mime-stream-shared.c	(revision 7940)
+++ libbalsa/mime-stream-shared.c	(working copy)
@@ -60,10 +60,10 @@
 static ssize_t lbmss_stream_write(GMimeStream * stream, const char *buf,
                                   size_t len);
 static int lbmss_stream_reset(GMimeStream * stream);
-static off_t lbmss_stream_seek(GMimeStream * stream, off_t offset,
+static gint64 lbmss_stream_seek(GMimeStream * stream, gint64 offset,
                                GMimeSeekWhence whence);
 static GMimeStream *lbmss_stream_substream(GMimeStream * stream,
-                                           off_t start, off_t end);
+                                           gint64 start, gint64 end);
 
 static GMimeStreamFsClass *parent_class = NULL;
 static GMutex *lbmss_mutex;
@@ -192,8 +192,8 @@
     return GMIME_STREAM_CLASS(parent_class)->reset(stream);
 }
 
-static off_t
-lbmss_stream_seek(GMimeStream * stream, off_t offset,
+static gint64
+lbmss_stream_seek(GMimeStream * stream, gint64 offset,
                   GMimeSeekWhence whence)
 {
     g_return_val_if_fail(lbmss_thread_has_lock(stream), -1);
@@ -201,7 +201,7 @@
 }
 
 static GMimeStream *
-lbmss_stream_substream(GMimeStream * stream, off_t start, off_t end)
+lbmss_stream_substream(GMimeStream * stream, gint64 start, gint64 end)
 {
     LibBalsaMimeStreamShared *stream_shared;
     GMimeStreamFs *fstream;
@@ -235,7 +235,7 @@
 {
     LibBalsaMimeStreamShared *stream_shared;
     GMimeStreamFs *fstream;
-    off_t start;
+    gint64 start;
 
     stream_shared =
         g_object_new(LIBBALSA_TYPE_MIME_STREAM_SHARED, NULL, NULL);
Index: libbalsa/gmime-stream-gnome-vfs.c
===================================================================
--- libbalsa/gmime-stream-gnome-vfs.c	(revision 7940)
+++ libbalsa/gmime-stream-gnome-vfs.c	(working copy)
@@ -56,12 +56,12 @@
 static int stream_close(GMimeStream * stream);
 static gboolean stream_eos(GMimeStream * stream);
 static int stream_reset(GMimeStream * stream);
-static off_t stream_seek(GMimeStream * stream, off_t offset,
+static gint64 stream_seek(GMimeStream * stream, gint64 offset,
 			 GMimeSeekWhence whence);
-static off_t stream_tell(GMimeStream * stream);
+static gint64 stream_tell(GMimeStream * stream);
 static ssize_t stream_length(GMimeStream * stream);
-static GMimeStream *stream_substream(GMimeStream * stream, off_t start,
-				     off_t end);
+static GMimeStream *stream_substream(GMimeStream * stream, gint64 start,
+				     gint64 end);
 
 
 static GMimeStreamClass *parent_class = NULL;
@@ -147,7 +147,7 @@
 	return -1;
 
     if (stream->bound_end != -1)
-	len = MIN(stream->bound_end - stream->position, (off_t) len);
+	len = MIN(stream->bound_end - stream->position, (gint64) len);
 
     /* make sure we are at the right position */
     gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position);
@@ -178,7 +178,7 @@
 	return -1;
 
     if (stream->bound_end != -1)
-	len = MIN(stream->bound_end - stream->position, (off_t) len);
+	len = MIN(stream->bound_end - stream->position, (gint64) len);
 
     /* make sure we are at the right position */
     gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position);
@@ -267,11 +267,11 @@
     return 0;
 }
 
-static off_t
-stream_seek(GMimeStream * stream, off_t offset, GMimeSeekWhence whence)
+static gint64
+stream_seek(GMimeStream * stream, gint64 offset, GMimeSeekWhence whence)
 {
     GMimeStreamGvfs *gvfs = (GMimeStreamGvfs *) stream;
-    off_t real;
+    gint64 real;
     GnomeVFSFileSize gvfs_real;
 
     g_return_val_if_fail(gvfs->handle != NULL, -1);
@@ -323,7 +323,7 @@
         gnome_vfs_tell(gvfs->handle, &gvfs_real) != GNOME_VFS_OK)
 	return -1;
     else
-        real = (off_t) gvfs_real;
+        real = (gint64) gvfs_real;
 
     /* reset eos if appropriate */
     if ((stream->bound_end != -1 && real < stream->bound_end) ||
@@ -335,7 +335,7 @@
     return real;
 }
 
-static off_t
+static gint64
 stream_tell(GMimeStream * stream)
 {
     return stream->position;
@@ -353,14 +353,14 @@
     if (gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_END, 0) != GNOME_VFS_OK ||
         gnome_vfs_tell(gvfs->handle, &bound_end) != GNOME_VFS_OK ||
         gnome_vfs_seek(gvfs->handle, GNOME_VFS_SEEK_START, stream->position) != GNOME_VFS_OK ||
-        (off_t) bound_end < stream->bound_start)
+        (gint64) bound_end < stream->bound_start)
         return -1;
 
-    return (off_t) bound_end - stream->bound_start;
+    return (ssize_t) bound_end - stream->bound_start;
 }
 
 static GMimeStream *
-stream_substream(GMimeStream * stream, off_t start, off_t end)
+stream_substream(GMimeStream * stream, gint64 start, gint64 end)
 {
     GMimeStreamGvfs *gvfs;
 
@@ -392,7 +392,7 @@
         start = 0;
 
     gvfs = g_object_new(GMIME_TYPE_STREAM_GVFS, NULL);
-    g_mime_stream_construct(GMIME_STREAM(gvfs), (off_t) start, -1);
+    g_mime_stream_construct(GMIME_STREAM(gvfs), (gint64) start, -1);
     gvfs->owner = TRUE;
     gvfs->eos = FALSE;
     gvfs->handle = handle;
@@ -413,7 +413,7 @@
  * Returns a stream using @handle with bounds @start and @end.
  **/
 GMimeStream *
-g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle, off_t start, off_t end)
+g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle, gint64 start, gint64 end)
 {
     GMimeStreamGvfs *gvfs;
 
Index: libbalsa/send.c
===================================================================
--- libbalsa/send.c	(revision 7940)
+++ libbalsa/send.c	(working copy)
@@ -294,7 +294,7 @@
 
     wrapper =
         g_mime_data_wrapper_new_with_stream(stream,
-                                            GMIME_PART_ENCODING_DEFAULT);
+                                            GMIME_CONTENT_ENCODING_DEFAULT);
     g_object_unref(stream);
 
     g_mime_part_set_content_object(mime_part, wrapper);
@@ -339,8 +339,8 @@
         mime_part = g_mime_part_new_with_type("text", "plain");
     }
 
-    g_mime_part_set_content_disposition(mime_part, GMIME_DISPOSITION_INLINE);
-    g_mime_part_set_encoding(mime_part, GMIME_PART_ENCODING_QUOTEDPRINTABLE);
+    g_mime_object_set_disposition(GMIME_OBJECT(mime_part), GMIME_DISPOSITION_INLINE);
+    g_mime_part_set_content_encoding(mime_part, GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
     g_mime_object_set_content_type_parameter(GMIME_OBJECT(mime_part),
                                              "charset",
                                              charset ? charset :
@@ -361,7 +361,7 @@
 	GMimeDataWrapper *wrapper;
 
 	stream = g_mime_stream_mem_new();
-	filter_stream = g_mime_stream_filter_new_with_stream(stream);
+	filter_stream = g_mime_stream_filter_new(stream);
 	filter = g_mime_filter_charset_new("UTF-8", charset);
 	g_mime_stream_filter_add(GMIME_STREAM_FILTER(filter_stream), filter);
 	g_object_unref(G_OBJECT(filter));
@@ -371,7 +371,7 @@
 
         wrapper =
             g_mime_data_wrapper_new_with_stream(stream,
-                                                GMIME_PART_ENCODING_DEFAULT);
+                                                GMIME_CONTENT_ENCODING_DEFAULT);
 	g_object_unref(stream);
 
 	g_mime_part_set_content_object(mime_part, wrapper);
@@ -404,8 +404,8 @@
         mime_part = g_mime_part_new_with_type("text", "html");
         g_mime_multipart_add_part(mpa, GMIME_OBJECT(mime_part));
         g_object_unref(G_OBJECT(mime_part));
-        g_mime_part_set_content_disposition(mime_part, GMIME_DISPOSITION_INLINE);
-        g_mime_part_set_encoding(mime_part, GMIME_PART_ENCODING_QUOTEDPRINTABLE);
+        g_mime_object_set_disposition(GMIME_OBJECT(mime_part), GMIME_DISPOSITION_INLINE);
+        g_mime_part_set_content_encoding(mime_part, GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
         g_mime_object_set_content_type_parameter(GMIME_OBJECT(mime_part),
                                                  "charset", "UTF-8");
 	lbs_set_content(mime_part, body->html_buffer);
@@ -469,10 +469,10 @@
         return result;
 
     if (fccbox)
-        g_mime_message_set_header(message->mime_msg, "X-Balsa-Fcc",
+        g_mime_object_set_header(GMIME_OBJECT(message->mime_msg), "X-Balsa-Fcc",
                                   fccbox->url);
 #if ENABLE_ESMTP
-    g_mime_message_set_header(message->mime_msg, "X-Balsa-SmtpServer",
+    g_mime_object_set_header(GMIME_OBJECT(message->mime_msg), "X-Balsa-SmtpServer",
 	                      libbalsa_smtp_server_get_name(smtp_server));
 
     big_message = libbalsa_smtp_server_get_big_message(smtp_server);
@@ -492,9 +492,9 @@
                 /* RFC 2046, 5.2.2: "...it is specified that entities of
                  * type "message/partial" must always have a content-
                  * transfer-encoding of 7bit (the default)" */
-                g_mime_part_set_encoding(GMIME_PART
+                g_mime_part_set_content_encoding(GMIME_PART
                                          (mime_msgs[i]->mime_part),
-                                         GMIME_PART_ENCODING_7BIT);
+                                         GMIME_CONTENT_ENCODING_7BIT);
                 libbalsa_set_message_id(mime_msgs[i]);
             }
             if (rc) {
@@ -736,10 +736,10 @@
 
 		mem_stream = new_message->stream;
 		filter_stream =
-		    g_mime_stream_filter_new_with_stream(mem_stream);
+		    g_mime_stream_filter_new(mem_stream);
 		filter =
-		    g_mime_filter_crlf_new( GMIME_FILTER_CRLF_ENCODE,
-					    GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+		    g_mime_filter_crlf_new( TRUE,
+					    FALSE);
 		g_mime_stream_filter_add(GMIME_STREAM_FILTER(filter_stream),
 					 filter);
 		g_object_unref(G_OBJECT(filter));
@@ -1574,13 +1574,13 @@
 		g_string_append_c(str, ' ');
 	    g_string_append_printf(str, "<%s>", (gchar *) list->data);
 	} while ((list = list->next) != NULL);
-	g_mime_message_set_header(msg, "References", str->str);
+	g_mime_object_set_header(GMIME_OBJECT(msg), "References", str->str);
 	g_string_free(str, TRUE);
     }
 
     if (message->in_reply_to)
 	/* There's no specific header function for In-Reply-To */
-	g_mime_message_set_header(msg, "In-Reply-To",
+	g_mime_object_set_header(GMIME_OBJECT(msg), "In-Reply-To",
 				  message->in_reply_to->data);
 }
 
@@ -1682,8 +1682,8 @@
 		    g_mime_content_type_new("message", "external-body");
 		mime_part=g_mime_object_new_type("message", "external-body");
 		g_mime_object_set_content_type(mime_part, content_type);
-		g_mime_part_set_encoding(GMIME_PART(mime_part),
-			                 GMIME_PART_ENCODING_7BIT);
+		g_mime_part_set_content_encoding(GMIME_PART(mime_part),
+			                 GMIME_CONTENT_ENCODING_7BIT);
 		if (body->filename && !strncmp(body->filename, "URL", 3)) {
 		    g_mime_object_set_content_type_parameter(mime_part,
 					     "access-type", "URL");
@@ -1756,13 +1756,13 @@
 		mime_part =
 		    GMIME_OBJECT(g_mime_part_new_with_type(mime_type[0],
 				                           mime_type[1]));
-		g_mime_part_set_content_disposition(GMIME_PART(mime_part),
+		g_mime_object_set_disposition(mime_part,
 			body->attach_mode == LIBBALSA_ATTACH_AS_INLINE ?
 			GMIME_DISPOSITION_INLINE : GMIME_DISPOSITION_ATTACHMENT);
 		if(strcasecmp(mime_type[0],"text") != 0)
 		{
-		    g_mime_part_set_encoding(GMIME_PART(mime_part),
-			    GMIME_PART_ENCODING_BASE64);
+		    g_mime_part_set_content_encoding(GMIME_PART(mime_part),
+			    GMIME_CONTENT_ENCODING_BASE64);
 		} else {
 		    /* is text */
 		    g_mime_object_set_content_type_parameter(mime_part,
@@ -1790,7 +1790,7 @@
 		    return LIBBALSA_MESSAGE_CREATE_ERROR;
 		}
 		content = g_mime_data_wrapper_new_with_stream(stream,
-			GMIME_PART_ENCODING_DEFAULT);
+			GMIME_CONTENT_ENCODING_DEFAULT);
 		g_object_unref(stream);
 		g_mime_part_set_content_object(GMIME_PART(mime_part),
 			                       content);
@@ -1900,7 +1900,7 @@
         tmp = internet_address_to_string(message->headers->dispnotify_to->
                                          address, TRUE);
 	if (tmp) {
-	    g_mime_message_add_header(mime_message,
+	    g_mime_object_append_header(GMIME_OBJECT(mime_message),
 				      "Disposition-Notification-To", tmp);
 	    g_free(tmp);
 	}
@@ -1909,14 +1909,14 @@
     for (list = message->headers->user_hdrs; list; list = list->next) {
 	gchar **pair = list->data;
 	g_strchug(pair[1]);
-	g_mime_message_add_header(mime_message, pair[0], pair[1]);
+	g_mime_object_append_header(GMIME_OBJECT(mime_message), pair[0], pair[1]);
 #if DEBUG_USER_HEADERS
         printf("adding header '%s:%s'\n", pair[0], pair[1]);
 #endif
     }
 
     tmp = g_strdup_printf("Balsa %s", VERSION);
-    g_mime_message_add_header(mime_message, "X-Mailer", tmp);
+    g_mime_object_append_header(GMIME_OBJECT(mime_message), "X-Mailer", tmp);
     g_free(tmp);
 
     message->mime_msg = mime_message;
@@ -1947,7 +1947,7 @@
 	gint i;
 
 	for (i = 0; extra_headers[i] && extra_headers[i + 1]; i += 2)
-	    g_mime_message_set_header(message->mime_msg, extra_headers[i],
+	    g_mime_object_set_header(GMIME_OBJECT(message->mime_msg), extra_headers[i],
 				      extra_headers[i + 1]);
     }
 
Index: libbalsa/gmime-stream-gnome-vfs.h
===================================================================
--- libbalsa/gmime-stream-gnome-vfs.h	(revision 7940)
+++ libbalsa/gmime-stream-gnome-vfs.h	(working copy)
@@ -61,8 +61,8 @@
 
 GMimeStream *g_mime_stream_gvfs_new(GnomeVFSHandle * handle);
 GMimeStream *g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle,
-                                                off_t start,
-						off_t end);
+                                                gint64 start,
+						gint64 end);
 
 gboolean g_mime_stream_gvfs_get_owner(GMimeStreamGvfs * stream);
 void g_mime_stream_gvfs_set_owner(GMimeStreamGvfs * stream,
@@ -136,8 +136,8 @@
 
 GMimeStream *g_mime_stream_gvfs_new(GnomeVFSHandle * handle);
 GMimeStream *g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle,
-                                                off_t start,
-						off_t end);
+                                                gint64 start,
+						gint64 end);
 
 gboolean g_mime_stream_gvfs_get_owner(GMimeStreamGvfs * stream);
 void g_mime_stream_gvfs_set_owner(GMimeStreamGvfs * stream,
@@ -211,8 +211,8 @@
 
 GMimeStream *g_mime_stream_gvfs_new(GnomeVFSHandle * handle);
 GMimeStream *g_mime_stream_gvfs_new_with_bounds(GnomeVFSHandle * handle,
-                                                off_t start,
-						off_t end);
+                                                gint64 start,
+						gint64 end);
 
 gboolean g_mime_stream_gvfs_get_owner(GMimeStreamGvfs * stream);
 void g_mime_stream_gvfs_set_owner(GMimeStreamGvfs * stream,
Index: libbalsa/mailbox_maildir.c
===================================================================
--- libbalsa/mailbox_maildir.c	(revision 7940)
+++ libbalsa/mailbox_maildir.c	(working copy)
@@ -911,10 +911,10 @@
 	return FALSE;
     out_stream = g_mime_stream_fs_new(fd);
 
-    in_stream = g_mime_stream_filter_new_with_stream(stream);
+    in_stream = g_mime_stream_filter_new(stream);
     crlffilter =
-        g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-                               GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+        g_mime_filter_crlf_new(FALSE,
+                               FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(in_stream), crlffilter);
     g_object_unref(crlffilter);
  
Index: libbalsa/gmime-part-rfc2440.c
===================================================================
--- libbalsa/gmime-part-rfc2440.c	(revision 7940)
+++ libbalsa/gmime-part-rfc2440.c	(working copy)
@@ -133,12 +133,12 @@
     ctx->singlepart_mode = TRUE;
     if (recipients == NULL)
 	result =
-	    g_mime_cipher_sign(GMIME_CIPHER_CONTEXT(ctx), sign_userid,
+	    g_mime_cipher_context_sign(GMIME_CIPHER_CONTEXT(ctx), sign_userid,
 			       GMIME_CIPHER_HASH_DEFAULT, stream,
 			       cipherstream, err);
     else
 	result =
-	    g_mime_cipher_encrypt(GMIME_CIPHER_CONTEXT(ctx),
+	    g_mime_cipher_context_encrypt(GMIME_CIPHER_CONTEXT(ctx),
 				  sign_userid != NULL, sign_userid,
 				  recipients, stream, cipherstream, err);
     g_object_unref(stream);
@@ -177,15 +177,15 @@
      * and set the charset to us-ascii instead, as gpg added it's own armor.
      */
     if (recipients == NULL) {
-	if (g_mime_part_get_encoding(part) != GMIME_PART_ENCODING_BASE64)
-	    g_mime_part_set_encoding(part,
-				     GMIME_PART_ENCODING_QUOTEDPRINTABLE);
+	if (g_mime_part_get_content_encoding(part) != GMIME_CONTENT_ENCODING_BASE64)
+	    g_mime_part_set_content_encoding(part,
+				     GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE);
 	g_mime_data_wrapper_set_encoding(wrapper,
-					 GMIME_PART_ENCODING_DEFAULT);
+					 GMIME_CONTENT_ENCODING_DEFAULT);
     } else {
-	g_mime_part_set_encoding(part, GMIME_PART_ENCODING_7BIT);
+	g_mime_part_set_content_encoding(part, GMIME_CONTENT_ENCODING_7BIT);
 	g_mime_data_wrapper_set_encoding(wrapper,
-					 GMIME_PART_ENCODING_7BIT);
+					 GMIME_CONTENT_ENCODING_7BIT);
 	g_mime_object_set_content_type_parameter(GMIME_OBJECT(part),
 						 "charset", "US-ASCII");
     }
@@ -233,7 +233,7 @@
     /* verify the signature */
     ctx->singlepart_mode = TRUE;
     valid =
-	g_mime_cipher_verify(GMIME_CIPHER_CONTEXT(ctx),
+	g_mime_cipher_context_verify(GMIME_CIPHER_CONTEXT(ctx),
 			     GMIME_CIPHER_HASH_DEFAULT, stream,
 			     plainstream, err);
     g_object_unref(stream);
@@ -290,7 +290,7 @@
 
     /* decrypt and (if possible) verify the input */
     result =
-	g_mime_cipher_decrypt(GMIME_CIPHER_CONTEXT(ctx), stream,
+	g_mime_cipher_context_decrypt(GMIME_CIPHER_CONTEXT(ctx), stream,
 			      plainstream, err);
 
     if (result == 0) {
@@ -300,9 +300,9 @@
 	GMimeDataWrapper *wrapper = g_mime_data_wrapper_new();
 
 	/* strip crlf off encrypted stuff coming from Winbloze crap */
-	filter_stream = g_mime_stream_filter_new_with_stream(plainstream);
-	filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-					GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+	filter_stream = g_mime_stream_filter_new(plainstream);
+	filter = g_mime_filter_crlf_new(FALSE,
+					FALSE);
 	g_mime_stream_filter_add(GMIME_STREAM_FILTER(filter_stream), filter);
 	g_object_unref(filter);
 
@@ -315,7 +315,7 @@
 	g_mime_stream_write_to_stream(filter_stream, out_stream);
 	g_object_unref(filter_stream);
 
-	g_mime_part_set_encoding(part, GMIME_PART_ENCODING_8BIT);
+	g_mime_part_set_content_encoding(part, GMIME_CONTENT_ENCODING_8BIT);
 
 	/*
  	 * Set the charset of the decrypted content to the RFC 2440 "Charset:"
Index: libbalsa/mailbox_imap.c
===================================================================
--- libbalsa/mailbox_imap.c	(revision 7940)
+++ libbalsa/mailbox_imap.c	(working copy)
@@ -1801,21 +1801,13 @@
 
     if (addr->name) {
 	gchar *tmp =
-#if HAVE_GMIME_2_2_5
 	    g_mime_utils_header_decode_text(addr->name);
-#else  /* HAVE_GMIME_2_2_5 */
-	    g_mime_utils_header_decode_text((unsigned char *) addr->name);
-#endif /* HAVE_GMIME_2_2_5 */
 	internet_address_set_name(address, tmp);
 	g_free(tmp);
     }
     if (addr->addr_spec) {
 	gchar *tmp =
-#if HAVE_GMIME_2_2_5
 	    g_mime_utils_header_decode_text(addr->addr_spec);
-#else  /* HAVE_GMIME_2_2_5 */
-	    g_mime_utils_header_decode_text((unsigned char *) addr->addr_spec);
-#endif /* HAVE_GMIME_2_2_5 */
 	internet_address_set_addr(address, tmp);
 	g_free(tmp);
     } else {
@@ -1865,12 +1857,7 @@
 
     if(is_embedded) {
         headers->subject =
-#if HAVE_GMIME_2_2_5
             g_mime_utils_header_decode_text(envelope->subject);
-#else  /* HAVE_GMIME_2_2_5 */
-            g_mime_utils_header_decode_text((unsigned char *) envelope->
-                                            subject);
-#endif /* HAVE_GMIME_2_2_5 */
         libbalsa_utf8_sanitize(&headers->subject, TRUE, NULL);
     }
 }
@@ -1989,11 +1976,7 @@
     if(!str) str = imap_body_get_param(imap_body, "name");
     if(str) {
         lbbody->filename  =
-#if HAVE_GMIME_2_2_5
 	    g_mime_utils_header_decode_text(str);
-#else  /* HAVE_GMIME_2_2_5 */
-	    g_mime_utils_header_decode_text((unsigned char *) str);
-#endif /* HAVE_GMIME_2_2_5 */
         libbalsa_utf8_sanitize(&lbbody->filename, TRUE, NULL);
     }
     lbbody->charset   = g_strdup(imap_body_get_param(imap_body, "charset"));
@@ -2035,11 +2018,11 @@
             return FALSE;
 
         stream = g_mime_stream_fs_new(fd);
-        fstream = g_mime_stream_filter_new_with_stream(stream);
+        fstream = g_mime_stream_filter_new(stream);
         g_object_unref(stream);
 
-        filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-                                        GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+        filter = g_mime_filter_crlf_new(FALSE,
+                                        FALSE);
         g_mime_stream_filter_add(GMIME_STREAM_FILTER(fstream), filter);
         g_object_unref(filter);
 
@@ -2578,11 +2561,11 @@
 	if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
 	    IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
 
-	tmpstream = g_mime_stream_filter_new_with_stream(stream);
+	tmpstream = g_mime_stream_filter_new(stream);
 
 	crlffilter =
-	    g_mime_filter_crlf_new(GMIME_FILTER_CRLF_ENCODE,
-				   GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+	    g_mime_filter_crlf_new(TRUE,
+				   FALSE);
 	g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
 	g_object_unref(crlffilter);
 
@@ -2703,11 +2686,11 @@
 	if (flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
 	    IMSG_FLAG_SET(imap_flags, IMSGF_ANSWERED);
 
-	tmpstream = g_mime_stream_filter_new_with_stream(stream);
+	tmpstream = g_mime_stream_filter_new(stream);
 
 	crlffilter =
-	    g_mime_filter_crlf_new(GMIME_FILTER_CRLF_ENCODE,
-				   GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+	    g_mime_filter_crlf_new(TRUE,
+				   FALSE);
 	g_mime_stream_filter_add(GMIME_STREAM_FILTER(tmpstream), crlffilter);
 	g_object_unref(crlffilter);
 
Index: libbalsa/libbalsa.c
===================================================================
--- libbalsa/libbalsa.c	(revision 7940)
+++ libbalsa/libbalsa.c	(working copy)
@@ -627,7 +627,12 @@
 libbalsa_abort_on_timeout(const char *host)
 {  /* It appears not to be entirely thread safe... Some locks do not
       get released as they should be. */
-    return libbalsa_ask(ask_timeout_real, (void*)host) != 0; 
+    char *hostname;
+
+    hostname = g_alloca (strlen (host) + 1);
+    strcpy (hostname, host);
+    
+    return libbalsa_ask(ask_timeout_real, hostname) != 0; 
 }
 
 
@@ -834,9 +839,9 @@
     GtkWidget *image = NULL;
 
     stream = g_mime_stream_mem_new();
-    stream_filter = g_mime_stream_filter_new_with_stream(stream);
+    stream_filter = g_mime_stream_filter_new(stream);
 
-    filter = g_mime_filter_basic_new_type(GMIME_FILTER_BASIC_BASE64_DEC);
+    filter = g_mime_filter_basic_new(GMIME_CONTENT_ENCODING_BASE64, FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), filter);
     g_object_unref(filter);
 
Index: libbalsa/address.c
===================================================================
--- libbalsa/address.c	(revision 7940)
+++ libbalsa/address.c	(working copy)
@@ -207,14 +207,10 @@
     gint len = strlen(str);
     gchar * newstr = g_malloc0(len + 1);
     int state = 0;
-#if HAVE_GMIME_2_2_5
     guint32 save;
-#else  /* HAVE_GMIME_2_2_5 */
-    int save;
-#endif /* HAVE_GMIME_2_2_5 */
 
     /* qp decode the input string */
-    g_mime_utils_quoted_decode_step((unsigned char *) str, len,
+    g_mime_encoding_quoted_decode_step((unsigned char *) str, len,
 				    (unsigned char *) newstr, &state, &save);
 
     /* free input and return new string */
@@ -232,7 +228,7 @@
     guint32 save;
 
     /* base64 decode the input string */
-    g_mime_utils_base64_decode_step((unsigned char *) str, len,
+    g_mime_encoding_base64_decode_step((unsigned char *) str, len,
 				    (unsigned char *) newstr, &state, &save);
 
     /* free input and return new string */
Index: libbalsa/html.c
===================================================================
--- libbalsa/html.c	(revision 7940)
+++ libbalsa/html.c	(working copy)
@@ -539,7 +539,7 @@
     array = g_byte_array_new();
     g_mime_stream_mem_set_byte_array(GMIME_STREAM_MEM(stream), array);
 
-    filter_stream = g_mime_stream_filter_new_with_stream(stream);
+    filter_stream = g_mime_stream_filter_new(stream);
     g_object_unref(stream);
 
     filter = g_mime_filter_enriched_new(flags);
Index: libbalsa/gmime-application-pkcs7.c
===================================================================
--- libbalsa/gmime-application-pkcs7.c	(revision 7940)
+++ libbalsa/gmime-application-pkcs7.c	(working copy)
@@ -50,7 +50,7 @@
 static void
 sign_prepare (GMimeObject *mime_part)
 {
-    GMimePartEncodingType encoding;
+    GMimeContentEncoding encoding;
     GMimeObject *subpart;
 	
     if (GMIME_IS_MULTIPART (mime_part)) {
@@ -71,11 +71,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);
     }
 }
 
@@ -105,7 +105,7 @@
 	
     /* get the cleartext */
     stream = g_mime_stream_mem_new ();
-    filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+    filtered_stream = g_mime_stream_filter_new (stream);
 	
     /* See RFC 2633, Sect. 3.1- the following op's are "SHOULD", so we do it */
     from_filter = g_mime_filter_from_new (GMIME_FILTER_FROM_MODE_ARMOR);
@@ -117,9 +117,9 @@
     g_object_unref (filtered_stream);
     g_mime_stream_reset (stream);
 	
-    filtered_stream = g_mime_stream_filter_new_with_stream (stream);
-    crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_ENCODE,
-					  GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+    filtered_stream = g_mime_stream_filter_new (stream);
+    crlf_filter = g_mime_filter_crlf_new (TRUE,
+					  FALSE);
     g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), crlf_filter);
     g_object_unref (crlf_filter);
 	
@@ -127,7 +127,7 @@
     sig_data_stream = g_mime_stream_mem_new ();
 	
     /* get the signed content */
-    if (g_mime_cipher_sign (ctx, userid, GMIME_CIPHER_HASH_DEFAULT, filtered_stream, sig_data_stream, err) == -1) {
+    if (g_mime_cipher_context_sign (ctx, userid, GMIME_CIPHER_HASH_DEFAULT, filtered_stream, sig_data_stream, err) == -1) {
 	g_object_unref (filtered_stream);
 	g_object_unref (sig_data_stream);
 	g_object_unref (stream);
@@ -144,8 +144,8 @@
     g_object_unref(sig_data_stream);
     g_mime_part_set_content_object(GMIME_PART(pkcs7), wrapper);
     g_mime_part_set_filename(GMIME_PART(pkcs7), "smime.p7m");
-    g_mime_part_set_encoding(GMIME_PART(pkcs7),
-			     GMIME_PART_ENCODING_BASE64);
+    g_mime_part_set_content_encoding(GMIME_PART(pkcs7),
+			     GMIME_CONTENT_ENCODING_BASE64);
     g_object_unref(wrapper);
 
     /* set the content-type params for this part */
@@ -200,15 +200,15 @@
     g_object_unref(wrapper);
 
     stream = g_mime_stream_mem_new();
-    filtered_stream = g_mime_stream_filter_new_with_stream(stream);
-    crlf_filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-					 GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+    filtered_stream = g_mime_stream_filter_new(stream);
+    crlf_filter = g_mime_filter_crlf_new(FALSE,
+					 FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
 			     crlf_filter);
     g_object_unref(crlf_filter);
 
     /* get the cleartext */
-    *validity = g_mime_cipher_verify(ctx, GMIME_CIPHER_HASH_DEFAULT,
+    *validity = g_mime_cipher_context_verify(ctx, GMIME_CIPHER_HASH_DEFAULT,
 				     ciphertext, filtered_stream, err);
     if (!*validity) {
 	g_object_unref(filtered_stream);
@@ -263,10 +263,10 @@
 	
     /* get the cleartext */
     stream = g_mime_stream_mem_new ();
-    filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+    filtered_stream = g_mime_stream_filter_new (stream);
 	
-    crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_ENCODE,
-					  GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+    crlf_filter = g_mime_filter_crlf_new (TRUE,
+					  FALSE);
     g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), crlf_filter);
     g_object_unref (crlf_filter);
 	
@@ -279,7 +279,7 @@
 	
     /* encrypt the content stream */
     ciphertext = g_mime_stream_mem_new ();
-    if (g_mime_cipher_encrypt (ctx, FALSE, NULL, recipients, stream, ciphertext, err) == -1) {
+    if (g_mime_cipher_context_encrypt (ctx, FALSE, NULL, recipients, stream, ciphertext, err) == -1) {
 	g_object_unref (ciphertext);
 	g_object_unref (stream);
 	return -1;
@@ -294,7 +294,7 @@
     g_object_unref(ciphertext);
     g_mime_part_set_content_object(GMIME_PART(pkcs7), wrapper);
     g_mime_part_set_filename(GMIME_PART(pkcs7), "smime.p7m");
-    g_mime_part_set_encoding(GMIME_PART(pkcs7), GMIME_PART_ENCODING_BASE64);
+    g_mime_part_set_content_encoding(GMIME_PART(pkcs7), GMIME_CONTENT_ENCODING_BASE64);
     g_object_unref(wrapper);
 
     /* set the content-type params for this part */
@@ -345,15 +345,15 @@
     g_object_unref(wrapper);
 
     stream = g_mime_stream_mem_new();
-    filtered_stream = g_mime_stream_filter_new_with_stream(stream);
-    crlf_filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-					 GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+    filtered_stream = g_mime_stream_filter_new(stream);
+    crlf_filter = g_mime_filter_crlf_new(FALSE,
+					 FALSE);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(filtered_stream),
 			     crlf_filter);
     g_object_unref(crlf_filter);
 
     /* get the cleartext */
-    if (g_mime_cipher_decrypt(ctx, ciphertext, filtered_stream, err) == -1) {
+    if (g_mime_cipher_context_decrypt(ctx, ciphertext, filtered_stream, err) == -1) {
 	g_object_unref(filtered_stream);
 	g_object_unref(ciphertext);
 	g_object_unref(stream);
Index: libbalsa/misc.c
===================================================================
--- libbalsa/misc.c	(revision 7940)
+++ libbalsa/misc.c	(working copy)
@@ -490,16 +490,13 @@
 libbalsa_set_fallback_codeset(LibBalsaCodeset codeset)
 {
     LibBalsaCodeset ret = sanitize_fallback_codeset;
-#if defined(HAVE_GMIME_2_2_7)
     const gchar *charsets[] = {
-        g_strdup("UTF-8"),
-        g_strdup(libbalsa_get_codeset_name(NULL, codeset)),
+        "UTF-8",
+        libbalsa_get_codeset_name(NULL, codeset),
         NULL
     };
 
     g_mime_set_user_charsets(charsets);
-    /* GMime will free the strings. */
-#endif                          /* HAVE_GMIME_2_2_7 */
 
     sanitize_fallback_codeset = codeset;
     return ret;
Index: libbalsa/body.c
===================================================================
--- libbalsa/body.c	(revision 7940)
+++ libbalsa/body.c	(working copy)
@@ -114,11 +114,7 @@
     subj = g_mime_message_get_subject(msg);
     if (subj) {
 	ehdr->subject =
-#if HAVE_GMIME_2_2_5
 	    g_mime_utils_header_decode_text(subj);
-#else
-	    g_mime_utils_header_decode_text((const unsigned char *) subj);
-#endif
 	libbalsa_utf8_sanitize(&ehdr->subject, TRUE, NULL);
     } else 
 	ehdr->subject = g_strdup(_("(No subject)"));
@@ -198,13 +194,17 @@
 libbalsa_message_body_set_multipart(LibBalsaMessageBody * body,
 				    LibBalsaMessageBody ** next_part)
 {
-    GList *child;
-
-    for (child = GMIME_MULTIPART(body->mime_part)->subparts; child;
-	 child = child->next) {
+    GMimeMultipart *multipart = GMIME_MULTIPART(body->mime_part);
+    GMimeObject *part;
+    int count, i;
+    
+    count = g_mime_multipart_get_number (multipart);
+    for (i = 0; i < count; i++) {
+	part = g_mime_multipart_get_part (multipart, i);
 	if (!*next_part)
 	    *next_part = libbalsa_message_body_new(body->message);
-	libbalsa_message_body_set_mime_body(*next_part, child->data);
+	libbalsa_message_body_set_mime_body(*next_part, part);
+	g_object_unref (part);
 	next_part = &(*next_part)->next;
     }
 
@@ -413,7 +413,7 @@
 {
     if (!GMIME_IS_STREAM_FILTER(stream)) {
         GMimeStream *filtered_stream =
-            g_mime_stream_filter_new_with_stream(stream);
+            g_mime_stream_filter_new(stream);
         g_object_unref(stream);
         stream = filtered_stream;
     }
@@ -437,7 +437,7 @@
 
     if (body->message->mailbox) {
         GMimeDataWrapper *wrapper;
-        GMimePartEncodingType encoding;
+        GMimeContentEncoding encoding;
 
         if(!libbalsa_mailbox_get_message_part(body->message, body, err))
             return NULL;
@@ -449,22 +449,22 @@
         g_object_unref(wrapper);
 
         switch (encoding) {
-        case GMIME_PART_ENCODING_BASE64:
+        case GMIME_CONTENT_ENCODING_BASE64:
             filter =
-                g_mime_filter_basic_new_type
-                (GMIME_FILTER_BASIC_BASE64_DEC);
+                g_mime_filter_basic_new
+                (GMIME_CONTENT_ENCODING_BASE64, FALSE);
             stream =
                 libbalsa_message_body_stream_add_filter(stream, filter);
             break;
-        case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
+        case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
             filter =
-                g_mime_filter_basic_new_type(GMIME_FILTER_BASIC_QP_DEC);
+                g_mime_filter_basic_new(GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE, FALSE);
             stream =
                 libbalsa_message_body_stream_add_filter(stream, filter);
             break;
-        case GMIME_PART_ENCODING_UUENCODE:
+        case GMIME_CONTENT_ENCODING_UUENCODE:
             filter =
-                g_mime_filter_basic_new_type(GMIME_FILTER_BASIC_UU_DEC);
+                g_mime_filter_basic_new(GMIME_CONTENT_ENCODING_UUENCODE, FALSE);
             stream =
                 libbalsa_message_body_stream_add_filter(stream, filter);
             break;
@@ -501,7 +501,7 @@
         GMimeFilter *filter_windows;
 
         stream_null = g_mime_stream_null_new();
-        stream_filter = g_mime_stream_filter_new_with_stream(stream_null);
+        stream_filter = g_mime_stream_filter_new(stream_null);
         g_object_unref(stream_null);
 
         filter_windows = g_mime_filter_windows_new(charset);
@@ -630,13 +630,13 @@
 
             if (!GMIME_IS_STREAM_FILTER(stream)) {
                 GMimeStream *stream_filter =
-                    g_mime_stream_filter_new_with_stream(stream);
+                    g_mime_stream_filter_new(stream);
                 g_object_unref(stream);
                 stream = stream_filter;
             }
 
-            filter = g_mime_filter_crlf_new(GMIME_FILTER_CRLF_DECODE,
-                                            GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
+            filter = g_mime_filter_crlf_new(FALSE,
+                                            FALSE);
             g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream), filter);
             g_object_unref(filter);
         }
