Index: configure.in
===================================================================
--- configure.in	(revision 348)
+++ configure.in	(working copy)
@@ -18,7 +18,7 @@
 
 PCRE_REQUIRED=5.0
 GLIB_REQUIRED=2.4.0
-GMIME_REQUIRED=2.1.9
+GMIME_REQUIRED=2.3.5
 GTK_REQUIRED=2.4.0
 GTKSPELL_REQUIRED=2.0.7
 AC_SUBST(PCRE_REQUIRED)
@@ -49,7 +49,7 @@
 
 PKG_CHECK_MODULES(PCRE,  libpcre      >= $PCRE_REQUIRED)
 AM_PATH_GLIB_2_0($GLIB_REQUIRED,,exit 1,gobject gmodule gthread)
-PKG_CHECK_MODULES(GMIME, gmime-2.0    >= $GMIME_REQUIRED)
+PKG_CHECK_MODULES(GMIME, gmime-2.4    >= $GMIME_REQUIRED)
 AM_PATH_GTK_2_0($GTK_REQUIRED,,exit 1,gthread)
 
 
Index: pan/usenet-utils/message-check.cc
===================================================================
--- pan/usenet-utils/message-check.cc	(revision 348)
+++ pan/usenet-utils/message-check.cc	(working copy)
@@ -62,7 +62,7 @@
       std::string body (body_in.to_string());
 
       // strip attribution
-      const char * attribution = g_mime_message_get_header (message, PAN_ATTRIBUTION);
+      const char * attribution = g_mime_object_get_header ((GMimeObject *) message, PAN_ATTRIBUTION);
       if (attribution && *attribution)
       {
          std::string::size_type attrib_start_pos = body.find (attribution);
@@ -99,7 +99,7 @@
                     GMimeMessage           * message)
   {
     // if it's not a reply, then top-posting check is moot
-    if (g_mime_message_get_header (message, "References") == NULL)
+    if (g_mime_object_get_header ((GMimeObject *) message, "References") == NULL)
       return;
 
     bool quoted_found (false);
@@ -432,7 +432,7 @@
   check_subject (errors, goodness, g_mime_message_get_subject (message));
 
   // check the author...
-  if (GNKSA::check_from (g_mime_message_get_header (message, "From"), true)) {
+  if (GNKSA::check_from (g_mime_object_get_header ((GMimeObject *) message, "From"), true)) {
     errors.insert (_("Error: Bad email address."));
     goodness.raise_to_warn ();
   }
@@ -447,10 +447,10 @@
   }
   check_body (errors, goodness, tm, message, body, attribution);
   g_free (body);
-
+  
   // check the optional followup-to...
   bool followup_to_set (false);
-  const char * cpch = g_mime_message_get_header (message, "Followup-To");
+  const char * cpch = g_mime_object_get_header ((GMimeObject *) message, "Followup-To");
   if (cpch && *cpch) {
     quarks_t groups;
     get_nntp_rcpts (cpch, groups);
@@ -460,7 +460,7 @@
 
   // check the groups...
   size_t group_qty (0);
-  cpch = g_mime_message_get_header (message, "Newsgroups");
+  cpch = g_mime_object_get_header ((GMimeObject *) message, "Newsgroups");
   if (cpch && *cpch) {
     quarks_t groups;
     get_nntp_rcpts (cpch, groups);
Index: pan/usenet-utils/message-check-test.cc
===================================================================
--- pan/usenet-utils/message-check-test.cc	(revision 348)
+++ pan/usenet-utils/message-check-test.cc	(working copy)
@@ -22,6 +22,20 @@
       std::cerr << LINE_ID << " [" << i << "][" << *it << ']' << std::endl; \
   }
 
+static void
+mime_part_set_content (GMimePart *part, const char *str)
+{
+	GMimeDataWrapper *content;
+	GMimeStream *stream;
+	
+	stream = g_mime_stream_mem_new_with_buffer (str, strlen (str));
+	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);
+	g_object_unref (content);
+}
+
 int main (void)
 {
   g_mime_init (0);
@@ -41,11 +55,11 @@
   std::string message_id = GNKSA :: generate_message_id ("rebelbase.com");
   g_mime_message_set_message_id (msg, message_id.c_str());
   g_mime_message_set_subject (msg, "MAKE MONEY FAST");
-  g_mime_message_set_header (msg, "Organization", "Lazars Android Works");
-  g_mime_message_set_header (msg, "Newsgroups", "alt.test");
+  g_mime_object_set_header ((GMimeObject *) msg, "Organization", "Lazars Android Works");
+  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
   GMimePart * part = g_mime_part_new_with_type ("text", "plain");
   const char * cpch = "Hello World!";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
   // this should pass the tests
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
@@ -54,7 +68,7 @@
 
   // all quoted
   cpch = "> Hello World!\n> All quoted text.";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   std::vector<std::string> e (errors.begin(), errors.end());
   check (errors.size() == 2)
@@ -64,7 +78,7 @@
 
   // mostly quoted
   cpch = "> Hello World!\n> quoted\n> text\n> foo\n> bar\nnew text";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -73,14 +87,14 @@
 
   // mostly quoted border condition: 20% of message is new content (should pass)
   cpch = "> Hello World!\n> quoted\n> text\n> foo\nnew text";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   check (errors.empty())
   check (goodness.is_ok())
 
   // sig check: too long
   cpch = "Hello!\n\n-- \nThis\nSig\nIs\nToo\nLong\n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -95,7 +109,7 @@
          "This sig line is greater than 80 characters wide.  In fact, it's 84 characters wide.\n"
          "This sig line is greater than 80 characters wide.  In fact, it measures 95 characters in width!\n"
          "This sig line is less than 80 characters wide.";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -104,7 +118,7 @@
 
   // sig check: sig marker, no sig
   cpch = "Hello!\n\n-- \n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -113,7 +127,7 @@
 
   // sig check: okay sig
   cpch = "Hello!\n\n-- \nThis is a short, narrow sig.\nIt should pass.\n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   check (errors.empty())
   check (goodness.is_ok())
@@ -146,7 +160,7 @@
          "This sig line is greater than 80 characters wide.  In fact, it's 84 characters wide.\n"
          "This sig line is greater than 80 characters wide.  In fact, it measures 95 characters in width!\n"
          "This sig line is less than 80 characters wide.";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -155,7 +169,7 @@
 
   // body empty
   cpch = "\n\t\n   \n-- \nThis is the sig.";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 2)
@@ -163,7 +177,7 @@
   check (e[0] == "Error: Message appears to have no new content.");
   check (e[1] == "Error: Message is empty.");
   cpch = "Some valid message.";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
 
   // empty subject
   g_mime_message_set_subject (msg, "");
@@ -175,17 +189,17 @@
   g_mime_message_set_subject (msg, "Happy Lucky Feeling");
 
   // newsgroups
-  g_mime_message_set_header (msg, "Newsgroups", "alt.test,unknown.group");
+  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,unknown.group");
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
   check (goodness.is_warn())
   check (e[0] == "Warning: The posting profile's server doesn't carry newsgroup\n\t\"unknown.group\".\n\tIf the group name is correct, switch profiles in the \"From:\"\n\tline or edit the profile with \"Edit|Manage Posting Profiles\".")
-  g_mime_message_set_header (msg, "Newsgroups", "alt.test");
+	  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
 
   // newsgroups w/o followup
-  g_mime_message_set_header (msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
-  g_mime_header_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
+  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
+  g_mime_header_list_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -193,8 +207,8 @@
   check (e[0] == "Warning: Crossposting without setting Followup-To header.")
 
   // unknown follow-up
-  g_mime_message_set_header (msg, "Newsgroups", "alt.test");
-  g_mime_message_set_header (msg, "Followup-To", "alt.test,unknown.group");
+	  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
+  g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", "alt.test,unknown.group");
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -203,11 +217,11 @@
   g_mime_object_remove_header (GMIME_OBJECT(msg), "Followup-To");
 
   // top posting
-  g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
+  g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf@foo.com>");
   cpch = "How Fascinating!\n"
          "\n"
          "> Blah blah blah.\n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -216,7 +230,7 @@
   g_mime_object_remove_header (GMIME_OBJECT(msg), "References");
 
   // top posting
-  g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
+  g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf@foo.com>");
   cpch = "How Fascinating!\n"
          "\n"
          "> Blah blah blah.\n"
@@ -224,7 +238,7 @@
          "-- \n"
          "Pan shouldn't mistake this signature for\n"
          "original content in the top-posting check.\n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
@@ -238,7 +252,7 @@
          "\n"
          "--\n"
          "This is my signature.\n";
-  g_mime_part_set_content (part, cpch, strlen(cpch));
+  mime_part_set_content (part, cpch);
   MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
   e.assign (errors.begin(), errors.end());
   check (errors.size() == 1)
Index: pan/usenet-utils/mime-utils.cc
===================================================================
--- pan/usenet-utils/mime-utils.cc	(revision 348)
+++ pan/usenet-utils/mime-utils.cc	(working copy)
@@ -455,10 +455,10 @@
       part->stream = g_mime_stream_mem_new ();
       if (part->type != ENC_PLAIN) {
 	part->filter_stream =
-	  g_mime_stream_filter_new_with_stream (part->stream);
+	  g_mime_stream_filter_new (part->stream);
         part->filter = part->type == ENC_UU
-	  ? g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC)
-	  : g_mime_filter_yenc_new (GMIME_FILTER_YENC_DIRECTION_DECODE);
+	  ? g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_UUENCODE, FALSE)
+	  : g_mime_filter_yenc_new (FALSE);
 	g_mime_stream_filter_add (GMIME_STREAM_FILTER(part->filter_stream),
                                   part->filter);
       }
@@ -722,12 +722,15 @@
   {
     // if the part is a multipart, check its subparts
     if (GMIME_IS_MULTIPART (*part)) {
-      GList * subparts = GMIME_MULTIPART (*part)->subparts;
-      while (subparts) {
-        GMimeObject * subpart = (GMimeObject *) subparts->data;
+      GMimeMultipart *multipart = (GMimeMultipart *) *part;
+      int count = g_mime_multipart_get_number (multipart);
+      int i;
+      
+      for (i = 0; i < count; i++) {
+        GMimeObject * subpart = g_mime_multipart_remove_part_at (multipart, i);
         handle_uu_and_yenc_in_text_plain (&subpart);
-        subparts->data = subpart;
-        subparts = subparts->next;
+        g_mime_multipart_add_part_at (multipart, subpart, i);
+        g_object_unref (subpart);
       }
       return;
     }
@@ -774,7 +777,7 @@
           g_mime_part_set_filename (subpart, filename);
 
         GMimeStream * subpart_stream = tmp_part->stream;
-        content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_PART_ENCODING_DEFAULT);
+        content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_CONTENT_ENCODING_DEFAULT);
         g_mime_part_set_content_object (subpart, content);
         g_mime_multipart_add_part (GMIME_MULTIPART (multipart), GMIME_OBJECT (subpart));
 
@@ -783,13 +786,13 @@
       }
 		
       // replace the old part with the new multipart
-      g_mime_object_unref (*part);
+      g_object_unref (*part);
       *part = GMIME_OBJECT (multipart);
     }
 
     foreach (temp_parts_t, parts, it)
       delete *it;
-    g_mime_stream_unref (istream);
+    g_object_unref (istream);
   }
 }
 
Index: pan/gui/body-pane.cc
===================================================================
--- pan/gui/body-pane.cc	(revision 348)
+++ pan/gui/body-pane.cc	(working copy)
@@ -978,7 +978,7 @@
                               const char    * key,
                               const char    * fallback_charset)
   {
-    const char * val (message ? g_mime_message_get_header (message, key) : "");
+    const char * val (message ? g_mime_object_get_header ((GMimeObject *) message, key) : "");
     const std::string utf8_val (header_to_utf8 (val, fallback_charset));
     char * e (0);
     if (strcmp (key, "From"))
@@ -1015,7 +1015,7 @@
                           const char    * key,
                           const char    * fallback_charset)
   {
-    const char * val (msg ? g_mime_message_get_header (msg, key) : "");
+    const char * val (msg ? g_mime_object_get_header ((GMimeObject *) msg, key) : "");
     return add_header_line (s, key_i18n, key, val, fallback_charset);
   }
 }
@@ -1037,19 +1037,19 @@
 
   // conditional headers...
   if (message) {
-    const StringView newsgroups (g_mime_message_get_header (message, "Newsgroups"));
+    const StringView newsgroups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
     if (newsgroups.strchr(',')) {
       l = add_header_line (s, message, _("Newsgroups"), "Newsgroups", fallback_charset);
       w = std::max (w, l);
     }
-    const StringView followup_to (g_mime_message_get_header (message, "Followup-To"));
+    const StringView followup_to (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
     if (!followup_to.empty() && (followup_to!=newsgroups)) {
       l = add_header_line (s, message, _("Followup-To"), "Followup-To", fallback_charset);
       w = std::max (w, l);
     }
-    const StringView reply_to (g_mime_message_get_header (message, "Reply-To"));
+    const StringView reply_to (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
     if (!reply_to.empty()) {
-      const StringView from (g_mime_message_get_header (message, "From"));
+      const StringView from (g_mime_object_get_header ((GMimeObject *) message, "From"));
       StringView f_addr, f_name, rt_addr, rt_name;
       GNKSA :: do_check_from (from, f_addr, f_name, false);
       GNKSA :: do_check_from (reply_to, rt_addr, rt_name, false);
@@ -1070,7 +1070,7 @@
 
   // set the x-face...
   GdkPixbuf * pixbuf (0);
-  const char * pch = message ? g_mime_message_get_header (message, "X-Face") : 0;
+  const char * pch = message ? g_mime_object_get_header ((GMimeObject *) message, "X-Face") : 0;
   if (pch && _xface->window)
     pixbuf = pan_gdk_pixbuf_create_from_x_face (gtk_widget_get_colormap(_xface), _xface->window, pch);
   gtk_image_set_from_pixbuf (GTK_IMAGE(_xface), pixbuf);
@@ -1101,7 +1101,7 @@
   // maybe add the headers
   const bool do_show_headers (_prefs.get_flag ("show-all-headers", false));
   if (message && do_show_headers) {
-    char * headers (g_mime_message_get_headers (message));
+    char * headers (g_mime_object_get_headers ((GMimeObject *) message));
     GtkTextIter end;
     gtk_text_buffer_get_end_iter (_buffer, &end);
     StringView line, v(headers);
@@ -1514,7 +1514,7 @@
                           const char   * fallback_charset_1,
                           const char   * fallback_charset_2)
   {
-    const StringView v (g_mime_message_get_header (msg, key));
+    const StringView v (g_mime_object_get_header ((GMimeObject *) msg, key));
     std::string s;
     if (!v.empty())
       s = header_to_utf8 (v, fallback_charset_1, fallback_charset_2);
@@ -1585,14 +1585,14 @@
     const std::string reply_to   (get_header (_message, "Reply-To",    message_charset, group_charset));
     if (is_reply || fup_to=="poster") {
       const std::string& to (reply_to.empty() ? from : reply_to);
-      g_mime_message_add_recipients_from_string (msg, (char*)GMIME_RECIPIENT_TYPE_TO, to.c_str());
+      g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.c_str());
     } else {
       const std::string& groups (fup_to.empty() ? newsgroups : fup_to);
-      g_mime_message_add_header (msg, "Newsgroups", groups.c_str());
+      g_mime_object_append_header ((GMimeObject *) msg, "Newsgroups", groups.c_str());
     }
 
     // Subject:
-    StringView v = g_mime_message_get_header (_message, "Subject");
+    StringView v = g_mime_object_get_header ((GMimeObject *) _message, "Subject");
     std::string h = header_to_utf8 (v, message_charset, group_charset);
     std::string val (normalize_subject_re (h));
     if (val.find ("Re:") != 0) // add "Re: " if we don't have one
@@ -1601,22 +1601,22 @@
 
     // attribution lines
 
-    const char * cpch = g_mime_message_get_header (_message, "From");
+    const char * cpch = g_mime_object_get_header ((GMimeObject *) _message, "From");
     h = header_to_utf8 (cpch, message_charset, group_charset);
-    g_mime_message_add_header (msg, "X-Draft-Attribution-Author", h.c_str());
+    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Author", h.c_str());
 
     cpch = g_mime_message_get_message_id (_message);
     h = header_to_utf8 (cpch, message_charset, group_charset);
-    g_mime_message_add_header (msg, "X-Draft-Attribution-Id", h.c_str());
+    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Id", h.c_str());
 
-    char * tmp = g_mime_message_get_date_string (_message);
+    char * tmp = g_mime_message_get_date_as_string (_message);
     h = header_to_utf8 (tmp, message_charset, group_charset);
-    g_mime_message_add_header (msg, "X-Draft-Attribution-Date", h.c_str());
+    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Date", h.c_str());
     g_free (tmp);
 
     // references
     const char * header = "References";
-    v = g_mime_message_get_header (_message, header);
+    v = g_mime_object_get_header ((GMimeObject *) _message, header);
     val.assign (v.str, v.len);
     if (!val.empty())
       val += ' ';
@@ -1624,7 +1624,7 @@
     val += g_mime_message_get_message_id (_message);
     val += ">";
     val = GNKSA :: trim_references (val);
-    g_mime_message_add_header (msg, header, val.c_str());
+    g_mime_object_append_header ((GMimeObject *) msg, header, val.c_str());
 
     ///
     ///  BODY
@@ -1660,17 +1660,17 @@
     // set the clone's content object with our modified body
     GMimeStream * stream = g_mime_stream_mem_new ();
     g_mime_stream_write_string (stream, s.c_str());
-    GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_8BIT);
+    GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_8BIT);
     GMimePart * part = g_mime_part_new ();
     GMimeContentType * new_type = g_mime_content_type_new_from_string ("text/plain; charset=UTF-8");
-    g_mime_part_set_content_type (part, new_type);
+    g_mime_object_set_content_type ((GMimeObject *) part, new_type);
     g_mime_part_set_content_object (part, wrapper);
-    g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
+    g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
     g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
     g_object_unref (wrapper);
     g_object_unref (part);
     g_object_unref (stream);
-//std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_message_to_string(msg) << ']' << std::endl;
+//std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_object_to_string((GMimeObject *) msg) << ']' << std::endl;
   }
 
   return msg;
Index: pan/gui/post-ui.cc
===================================================================
--- pan/gui/post-ui.cc	(revision 348)
+++ pan/gui/post-ui.cc	(working copy)
@@ -529,7 +529,7 @@
 {
   std::string url, to, groups;
   gboolean unused;
-  char * headers (g_mime_message_get_headers (message));
+  char * headers (g_mime_object_get_headers ((GMimeObject *) message));
   char * body (g_mime_message_get_body (message, true, &unused));
   StringView key, val, v(headers);
   v.trim ();
@@ -629,7 +629,7 @@
   *** If this is email only, skip the rest of the posting...
   *** we only stayed this long to get check_message()
   **/
-  const StringView groups (g_mime_message_get_header (message, "Newsgroups"));
+  const StringView groups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
   if (groups.empty()) {
     maybe_mail_message (message);
     return true;
@@ -903,9 +903,9 @@
    */
   void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
   {
-    g_mime_message_add_header (msg, "Message-ID", mid);
+    g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
     char * bracketed = g_strdup_printf ("<%s>", mid);
-    g_mime_header_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
+    g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
     g_free (bracketed);
   }
 }
@@ -933,22 +933,22 @@
   // headers from the ui: Newsgroups
   const StringView groups (gtk_entry_get_text (GTK_ENTRY(_groups_entry)));
   if (!groups.empty())
-    g_mime_message_set_header (msg, "Newsgroups", groups.str);
+    g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", groups.str);
 
   // headers from the ui: Followup-To
   const StringView followupto (gtk_entry_get_text (GTK_ENTRY(_followupto_entry)));
   if (!followupto.empty())
-    g_mime_message_set_header (msg, "Followup-To", followupto.str);
+    g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", followupto.str);
 
   // headers from the ui: Reply-To
   const StringView replyto (gtk_entry_get_text (GTK_ENTRY(_replyto_entry)));
   if (!replyto.empty())
-    g_mime_message_set_header (msg, "Reply-To", replyto.str);
+    g_mime_object_set_header ((GMimeObject *) msg, "Reply-To", replyto.str);
 
   // add the 'hidden headers'
   foreach_const (str2str_t, _hidden_headers, it)
     if ((mode==DRAFTING) || (it->first.find ("X-Draft-")!=0))
-      g_mime_message_set_header (msg, it->first.c_str(), it->second.c_str());
+      g_mime_object_set_header ((GMimeObject *) msg, it->first.c_str(), it->second.c_str());
 
   // build headers from the 'more headers' entry field
   std::map<std::string,std::string> headers;
@@ -964,14 +964,14 @@
     val.trim ();
     std::string key_str (key.to_string());
     if (extra_header_is_editable (key, val))
-      g_mime_message_set_header (msg, key.to_string().c_str(),
-                                      val.to_string().c_str());
+      g_mime_object_set_header ((GMimeObject *) msg, key.to_string().c_str(),
+                                val.to_string().c_str());
   }
   g_free (pch);
 
   // User-Agent
   if (mode==POSTING && _prefs.get_flag (USER_AGENT_PREFS_KEY, true))
-    g_mime_message_set_header (msg, "User-Agent", get_user_agent());
+    g_mime_object_set_header ((GMimeObject *) msg, "User-Agent", get_user_agent());
 
   // Message-ID
   if (mode==POSTING && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) {
@@ -987,22 +987,22 @@
   const std::string charset ((mode==POSTING && !_charset.empty()) ? _charset : "UTF-8");
   if (charset != "UTF-8") {
     // add a wrapper to convert from UTF-8 to $charset
-    GMimeStream * tmp = g_mime_stream_filter_new_with_stream (stream);
+    GMimeStream * tmp = g_mime_stream_filter_new (stream);
     g_object_unref (stream);
     GMimeFilter * filter = g_mime_filter_charset_new ("UTF-8", charset.c_str());
     g_mime_stream_filter_add (GMIME_STREAM_FILTER(tmp), filter);
     g_object_unref (filter);
     stream = tmp;
   }
-  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
+  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
   g_object_unref (stream);
   GMimePart * part = g_mime_part_new ();
   pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
   GMimeContentType * type = g_mime_content_type_new_from_string (pch);
   g_free (pch);
-  g_mime_part_set_content_type (part, type); // part owns type now. type isn't refcounted.
+  g_mime_object_set_content_type ((GMimeObject *) part, type); // part owns type now. type isn't refcounted.
   g_mime_part_set_content_object (part, content_object);
-  g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
+  g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
   g_object_unref (content_object);
   g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
   g_object_unref (part);
@@ -1036,7 +1036,7 @@
 
     errno = 0;
     std::ofstream o (filename);
-    char * pch = g_mime_message_to_string (msg);
+    char * pch = g_mime_object_to_string ((GMimeObject *) msg);
     o << pch;
     o.close ();
 
@@ -1504,13 +1504,13 @@
   std::string s = utf8ize (g_mime_message_get_subject (message));
   gtk_entry_set_text (GTK_ENTRY(_subject_entry), s.c_str());
 
-  s = utf8ize (g_mime_message_get_header (message, "Newsgroups"));
+  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
   gtk_entry_set_text (GTK_ENTRY(_groups_entry), s.c_str());
 
-  s = utf8ize (g_mime_message_get_header (message, "Followup-To"));
+  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
   gtk_entry_set_text (GTK_ENTRY(_followupto_entry), s.c_str());
 
-  s = utf8ize (g_mime_message_get_header (message, "Reply-To"));
+  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
   gtk_entry_set_text (GTK_ENTRY(_replyto_entry), s.c_str());
 
   const InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
@@ -1521,9 +1521,27 @@
 
   // update 'other headers'
   SetMessageForeachHeaderData data;
-  if (message->mime_part && g_mime_header_has_raw (message->mime_part->headers))
-    g_mime_header_foreach (message->mime_part->headers, set_message_foreach_header_func, &data);
-  g_mime_header_foreach (GMIME_OBJECT(message)->headers, set_message_foreach_header_func, &data);
+  const char *name, *value;
+  GMimeHeaderIter iter;
+  
+  if (message->mime_part && g_mime_header_list_has_raw (message->mime_part->headers)) {
+    if (g_mime_header_list_get_iter (message->mime_part->headers, &iter)) {
+      do {
+        value = g_mime_header_iter_get_value (&iter);
+        name = g_mime_header_iter_get_name (&iter);
+        set_message_foreach_header_func (name, value, &data);
+      } while (g_mime_header_iter_next (&iter));
+    }
+  }
+  
+  if (g_mime_header_list_get_iter (GMIME_OBJECT (message)->headers, &iter)) {
+    do {
+      value = g_mime_header_iter_get_value (&iter);
+      name = g_mime_header_iter_get_name (&iter);
+      set_message_foreach_header_func (name, value, &data);
+    } while (g_mime_header_iter_next (&iter));
+  }
+  
   s = utf8ize (data.visible_headers);
   gtk_text_buffer_set_text (_headers_buf, s.c_str(), -1);
   _hidden_headers = data.hidden_headers;
Index: pan/gui/gui.cc
===================================================================
--- pan/gui/gui.cc	(revision 348)
+++ pan/gui/gui.cc	(working copy)
@@ -1041,19 +1041,19 @@
   const char * cpch;
   char * old_mid (g_strdup_printf ("<%s>", g_mime_message_get_message_id(message)));
   GMimeMessage * new_message (g_mime_message_new (false));
-  g_mime_message_set_header (new_message, "Supersedes", old_mid);
+  g_mime_object_set_header ((GMimeObject *) new_message, "Supersedes", old_mid);
   g_mime_message_set_sender (new_message, g_mime_message_get_sender (message));
   g_mime_message_set_subject (new_message, g_mime_message_get_subject (message));
-  g_mime_message_set_header (new_message, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
-  g_mime_message_set_header (new_message, "References", g_mime_message_get_header (message, "References"));
+  g_mime_object_set_header ((GMimeObject *) new_message, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
+  g_mime_object_set_header ((GMimeObject *) new_message, "References", g_mime_object_get_header ((GMimeObject *) message, "References"));
   if ((cpch = g_mime_message_get_reply_to (message)))
               g_mime_message_set_reply_to (new_message, cpch);
-  if ((cpch = g_mime_message_get_header (message,     "Followup-To")))
-              g_mime_message_set_header (new_message, "Followup-To", cpch);
+  if ((cpch = g_mime_object_get_header ((GMimeObject *) message,     "Followup-To")))
+    g_mime_object_set_header ((GMimeObject *) new_message, "Followup-To", cpch);
   gboolean  unused (false);
   char * body (g_mime_message_get_body (message, true, &unused));
   GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
-  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
+  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
   GMimePart * part = g_mime_part_new ();
   g_mime_part_set_content_object (part, content_object);
   g_mime_message_set_mime_part (new_message, GMIME_OBJECT(part));
@@ -1111,11 +1111,11 @@
   char * cancel_message = g_strdup_printf ("cancel <%s>", g_mime_message_get_message_id(message));
   g_mime_message_set_sender (cancel, g_mime_message_get_sender (message));
   g_mime_message_set_subject (cancel, "Cancel");
-  g_mime_message_set_header (cancel, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
-  g_mime_message_set_header (cancel, "Control", cancel_message);
+  g_mime_object_set_header ((GMimeObject *) cancel, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
+  g_mime_object_set_header ((GMimeObject *) cancel, "Control", cancel_message);
   const char * body ("Ignore\r\nArticle canceled by author using " PACKAGE_STRING "\r\n");
   GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
-  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
+  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
   GMimePart * part = g_mime_part_new ();
   g_mime_part_set_content_object (part, content_object);
   g_mime_message_set_mime_part (cancel, GMIME_OBJECT(part));
@@ -1194,12 +1194,12 @@
       newsgroups = group;
   }
   if (!newsgroups.empty())
-    g_mime_message_add_header (message, "Newsgroups", newsgroups.c_str());
+    g_mime_object_append_header ((GMimeObject *) message, "Newsgroups", newsgroups.c_str());
 
   // content type
   GMimePart * part = g_mime_part_new ();
-  g_mime_part_set_content_type (part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
-  g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
+  g_mime_object_set_content_type ((GMimeObject *) part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
+  g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
   g_mime_message_set_mime_part (message, GMIME_OBJECT(part));
   g_object_unref (part);
 
Index: pan/general/utf8-utils.cc
===================================================================
--- pan/general/utf8-utils.cc	(revision 348)
+++ pan/general/utf8-utils.cc	(working copy)
@@ -136,7 +136,7 @@
 {
   std::string s = content_to_utf8 (header, fallback_charset1, fallback_charset2);
   if (header.strstr ("=?")) {
-    char * decoded (g_mime_utils_8bit_header_decode ((const guchar*) s.c_str()));
+    char * decoded (g_mime_utils_header_decode_text (s.c_str()));
     s = clean_utf8 (decoded);
     g_free (decoded);
   }
@@ -147,16 +147,27 @@
 pan :: mime_part_to_utf8 (GMimePart     * part,
                           const char    * fallback_charset)
 {
+  GMimeDataWrapper *content;
+  GMimeStream *stream;
+  const char *charset;
+  GByteArray *buffer;
   std::string ret;
 
   g_return_val_if_fail (GMIME_IS_PART(part), ret);
 
-  size_t content_len (0);
-  const char * specified_charset (g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset"));
-  const char * content = g_mime_part_get_content (part, &content_len);
-  if (content && content_len)
-    ret = content_to_utf8 (StringView (content, content_len), specified_charset, fallback_charset);
+  charset = g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset");
+  content = g_mime_part_get_content_object (part);
 
+  stream = g_mime_stream_mem_new ();
+  g_mime_data_wrapper_write_to_stream (content, stream);
+  g_object_unref (content);
+  
+  buffer = ((GMimeStreamMem *) stream)->buffer;
+  
+  ret = content_to_utf8 (StringView ((const char *) buffer->data, buffer->len), charset, fallback_charset);
+  
+  g_object_unref (stream);
+  
   return ret;
 }
 
