Ticket #3112: pan-0.133-gmime-gcc.patch

File pan-0.133-gmime-gcc.patch, 58.0 KB (added by Lars Bamberger, 14 years ago)

compile pan with new version of gmime and gcc

  • configure

    diff -Naur pan-0.133.orig/configure pan-0.133/configure
    old new  
    23772377
    23782378PCRE_REQUIRED=5.0
    23792379GLIB_REQUIRED=2.4.0
    2380 GMIME_REQUIRED=2.1.9
     2380GMIME_REQUIRED=2.3.5
    23812381GTK_REQUIRED=2.4.0
    23822382GTKSPELL_REQUIRED=2.0.7
    23832383
     
    79577957    pkg_cv_GMIME_CFLAGS="$GMIME_CFLAGS"
    79587958 elif test -n "$PKG_CONFIG"; then
    79597959    if test -n "$PKG_CONFIG" && \
    7960     { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.0    >= \$GMIME_REQUIRED\"") >&5
    7961   ($PKG_CONFIG --exists --print-errors "gmime-2.0    >= $GMIME_REQUIRED") 2>&5
     7960    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.4    >= \$GMIME_REQUIRED\"") >&5
     7961  ($PKG_CONFIG --exists --print-errors "gmime-2.4    >= $GMIME_REQUIRED") 2>&5
    79627962  ac_status=$?
    79637963  echo "$as_me:$LINENO: \$? = $ac_status" >&5
    79647964  (exit $ac_status); }; then
    7965   pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags "gmime-2.0    >= $GMIME_REQUIRED" 2>/dev/null`
     7965  pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags "gmime-2.4    >= $GMIME_REQUIRED" 2>/dev/null`
    79667966else
    79677967  pkg_failed=yes
    79687968fi
     
    79737973    pkg_cv_GMIME_LIBS="$GMIME_LIBS"
    79747974 elif test -n "$PKG_CONFIG"; then
    79757975    if test -n "$PKG_CONFIG" && \
    7976     { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.0    >= \$GMIME_REQUIRED\"") >&5
    7977   ($PKG_CONFIG --exists --print-errors "gmime-2.0    >= $GMIME_REQUIRED") 2>&5
     7976    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.4    >= \$GMIME_REQUIRED\"") >&5
     7977  ($PKG_CONFIG --exists --print-errors "gmime-2.4    >= $GMIME_REQUIRED") 2>&5
    79787978  ac_status=$?
    79797979  echo "$as_me:$LINENO: \$? = $ac_status" >&5
    79807980  (exit $ac_status); }; then
    7981   pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs "gmime-2.0    >= $GMIME_REQUIRED" 2>/dev/null`
     7981  pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs "gmime-2.4    >= $GMIME_REQUIRED" 2>/dev/null`
    79827982else
    79837983  pkg_failed=yes
    79847984fi
     
    79967996        _pkg_short_errors_supported=no
    79977997fi
    79987998        if test $_pkg_short_errors_supported = yes; then
    7999                 GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gmime-2.0    >= $GMIME_REQUIRED" 2>&1`
     7999                GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gmime-2.4    >= $GMIME_REQUIRED" 2>&1`
    80008000        else
    8001                 GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors "gmime-2.0    >= $GMIME_REQUIRED" 2>&1`
     8001                GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors "gmime-2.4    >= $GMIME_REQUIRED" 2>&1`
    80028002        fi
    80038003        # Put the nasty error message in config.log where it belongs
    80048004        echo "$GMIME_PKG_ERRORS" >&5
    80058005
    8006         { { echo "$as_me:$LINENO: error: Package requirements (gmime-2.0    >= $GMIME_REQUIRED) were not met:
     8006        { { echo "$as_me:$LINENO: error: Package requirements (gmime-2.4    >= $GMIME_REQUIRED) were not met:
    80078007
    80088008$GMIME_PKG_ERRORS
    80098009
     
    80148014and GMIME_LIBS to avoid the need to call pkg-config.
    80158015See the pkg-config man page for more details.
    80168016" >&5
    8017 echo "$as_me: error: Package requirements (gmime-2.0    >= $GMIME_REQUIRED) were not met:
     8017echo "$as_me: error: Package requirements (gmime-2.4    >= $GMIME_REQUIRED) were not met:
    80188018
    80198019$GMIME_PKG_ERRORS
    80208020
  • configure.in

    diff -Naur pan-0.133.orig/configure.in pan-0.133/configure.in
    old new  
    1818
    1919PCRE_REQUIRED=5.0
    2020GLIB_REQUIRED=2.4.0
    21 GMIME_REQUIRED=2.1.9
     21GMIME_REQUIRED=2.3.5
    2222GTK_REQUIRED=2.4.0
    2323GTKSPELL_REQUIRED=2.0.7
    2424AC_SUBST(PCRE_REQUIRED)
     
    5050
    5151PKG_CHECK_MODULES(PCRE,  libpcre      >= $PCRE_REQUIRED)
    5252AM_PATH_GLIB_2_0($GLIB_REQUIRED,,exit 1,gobject gmodule gthread)
    53 PKG_CHECK_MODULES(GMIME, gmime-2.0    >= $GMIME_REQUIRED)
     53PKG_CHECK_MODULES(GMIME, gmime-2.4    >= $GMIME_REQUIRED)
    5454AM_PATH_GTK_2_0($GTK_REQUIRED,,exit 1,gthread)
    5555
    5656
  • pan/general/log.cc

    diff -Naur pan-0.133.orig/pan/general/log.cc pan-0.133/pan/general/log.cc
    old new  
    2020#include <config.h>
    2121#include <iostream>
    2222#include <cstdarg>
     23#include <cstdio>
    2324#include "log.h"
    2425
    2526using namespace pan;
  • pan/general/progress.cc

    diff -Naur pan-0.133.orig/pan/general/progress.cc pan-0.133/pan/general/progress.cc
    old new  
    1919
    2020#include <config.h>
    2121#include <cstdarg>
     22#include <cstdio>
    2223#include "progress.h"
    2324#include "string-view.h"
    2425
  • pan/general/utf8-utils.cc

    diff -Naur pan-0.133.orig/pan/general/utf8-utils.cc pan-0.133/pan/general/utf8-utils.cc
    old new  
    136136{
    137137  std::string s = content_to_utf8 (header, fallback_charset1, fallback_charset2);
    138138  if (header.strstr ("=?")) {
    139     char * decoded (g_mime_utils_8bit_header_decode ((const guchar*) s.c_str()));
     139    char * decoded (g_mime_utils_header_decode_text (s.c_str()));
    140140    s = clean_utf8 (decoded);
    141141    g_free (decoded);
    142142  }
     
    147147pan :: mime_part_to_utf8 (GMimePart     * part,
    148148                          const char    * fallback_charset)
    149149{
     150  GMimeDataWrapper *content;
     151  GMimeStream *stream;
     152  const char *charset;
     153  GByteArray *buffer;
    150154  std::string ret;
    151155
    152156  g_return_val_if_fail (GMIME_IS_PART(part), ret);
    153157
    154   size_t content_len (0);
    155   const char * specified_charset (g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset"));
    156   const char * content = g_mime_part_get_content (part, &content_len);
    157   if (content && content_len)
    158     ret = content_to_utf8 (StringView (content, content_len), specified_charset, fallback_charset);
     158  charset = g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset");
     159  content = g_mime_part_get_content_object (part);
     160
     161  stream = g_mime_stream_mem_new ();
     162  g_mime_data_wrapper_write_to_stream (content, stream);
     163//g_object_unref(content);  //SKG gmime 2.4 don't unref returned data wrapper
     164 
     165  buffer = ((GMimeStreamMem *) stream)->buffer;
     166 
     167  ret = content_to_utf8 (StringView ((const char *) buffer->data, buffer->len), charset, fallback_charset);
     168 
     169  g_object_unref (stream);
    159170
    160171  return ret;
    161172}
  • pan/gui/body-pane.cc

    diff -Naur pan-0.133.orig/pan/gui/body-pane.cc pan-0.133/pan/gui/body-pane.cc
    old new  
    837837      }
    838838
    839839      g_object_unref (mem_stream);
    840       g_object_unref (wrapper);
     840      //g_object_unref (wrapper);  //SKG gmime 2.4 don't unref returned data wrapper
    841841    }
    842842
    843843    // flush the loader
     
    874874    return;
    875875
    876876  GMimePart * part = GMIME_PART (obj);
    877   const GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
     877  GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
    878878
    879879  // decide whether or not this part is a picture
    880880  bool is_image (g_mime_content_type_is_type (type, "image", "*"));
     
    952952    GtkTextIter iter;
    953953    gtk_text_buffer_get_end_iter (_buffer, &iter);
    954954    gtk_text_buffer_insert (_buffer, &iter, pch, -1);
    955     g_free (pch);
     955//    g_free (pch); //SKG don't unref returned const char *
    956956  }
    957957}
    958958void
    959 BodyPane :: foreach_part_cb (GMimeObject* o, gpointer self)
     959BodyPane :: foreach_part_cb (GMimeObject* /*parent*/, GMimeObject* o, gpointer self)
    960960{
    961961  if (GMIME_IS_MULTIPART (o))
    962962    g_mime_multipart_foreach (GMIME_MULTIPART (o), foreach_part_cb, self);
     
    978978                              const char    * key,
    979979                              const char    * fallback_charset)
    980980  {
    981     const char * val (message ? g_mime_message_get_header (message, key) : "");
     981    const char * val (message ? g_mime_object_get_header ((GMimeObject *) message, key) : "");
    982982    const std::string utf8_val (header_to_utf8 (val, fallback_charset));
    983983    char * e (0);
    984984    if (strcmp (key, "From"))
     
    10151015                          const char    * key,
    10161016                          const char    * fallback_charset)
    10171017  {
    1018     const char * val (msg ? g_mime_message_get_header (msg, key) : "");
     1018    const char * val (msg ? g_mime_object_get_header ((GMimeObject *) msg, key) : "");
    10191019    return add_header_line (s, key_i18n, key, val, fallback_charset);
    10201020  }
    10211021}
     
    10371037
    10381038  // conditional headers...
    10391039  if (message) {
    1040     const StringView newsgroups (g_mime_message_get_header (message, "Newsgroups"));
     1040    const StringView newsgroups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
    10411041    if (newsgroups.strchr(',')) {
    10421042      l = add_header_line (s, message, _("Newsgroups"), "Newsgroups", fallback_charset);
    10431043      w = std::max (w, l);
    10441044    }
    1045     const StringView followup_to (g_mime_message_get_header (message, "Followup-To"));
     1045    const StringView followup_to (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
    10461046    if (!followup_to.empty() && (followup_to!=newsgroups)) {
    10471047      l = add_header_line (s, message, _("Followup-To"), "Followup-To", fallback_charset);
    10481048      w = std::max (w, l);
    10491049    }
    1050     const StringView reply_to (g_mime_message_get_header (message, "Reply-To"));
     1050    const StringView reply_to (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
    10511051    if (!reply_to.empty()) {
    1052       const StringView from (g_mime_message_get_header (message, "From"));
     1052      const StringView from (g_mime_object_get_header ((GMimeObject *) message, "From"));
    10531053      StringView f_addr, f_name, rt_addr, rt_name;
    10541054      GNKSA :: do_check_from (from, f_addr, f_name, false);
    10551055      GNKSA :: do_check_from (reply_to, rt_addr, rt_name, false);
     
    10701070
    10711071  // set the x-face...
    10721072  GdkPixbuf * pixbuf (0);
    1073   const char * pch = message ? g_mime_message_get_header (message, "X-Face") : 0;
     1073  const char * pch = message ? g_mime_object_get_header ((GMimeObject *) message, "X-Face") : 0;
    10741074  if (pch && _xface->window)
    10751075    pixbuf = pan_gdk_pixbuf_create_from_x_face (gtk_widget_get_colormap(_xface), _xface->window, pch);
    10761076  gtk_image_set_from_pixbuf (GTK_IMAGE(_xface), pixbuf);
     
    11011101  // maybe add the headers
    11021102  const bool do_show_headers (_prefs.get_flag ("show-all-headers", false));
    11031103  if (message && do_show_headers) {
    1104     char * headers (g_mime_message_get_headers (message));
     1104    char * headers (g_mime_object_get_headers ((GMimeObject *) message));
    11051105    GtkTextIter end;
    11061106    gtk_text_buffer_get_end_iter (_buffer, &end);
    11071107    StringView line, v(headers);
     
    11191119
    11201120  // set the text buffer...
    11211121  if (message)
    1122     g_mime_message_foreach_part (message, foreach_part_cb, this);
     1122    g_mime_message_foreach (message, foreach_part_cb, this);
    11231123
    11241124  // if there was a picture, scroll to it.
    11251125  // otherwise scroll to the top of the body.
     
    15141514                          const char   * fallback_charset_1,
    15151515                          const char   * fallback_charset_2)
    15161516  {
    1517     const StringView v (g_mime_message_get_header (msg, key));
     1517    const StringView v (g_mime_object_get_header ((GMimeObject *) msg, key));
    15181518    std::string s;
    15191519    if (!v.empty())
    15201520      s = header_to_utf8 (v, fallback_charset_1, fallback_charset_2);
     
    15271527    std::string body;
    15281528  };
    15291529
    1530   void get_utf8_body_foreach_part (GMimeObject *o, gpointer user_data)
     1530  void get_utf8_body_foreach_part (GMimeObject * /*parent*/, GMimeObject *o, gpointer user_data)
    15311531  {
    15321532    if (GMIME_IS_MULTIPART(o))
    15331533    {
     
    15381538    else
    15391539    {
    15401540      GMimePart * part = GMIME_PART (o);
    1541       const GMimeContentType * type = g_mime_object_get_content_type (o);
     1541      GMimeContentType * type = g_mime_object_get_content_type (o);
    15421542      const bool is_text (g_mime_content_type_is_type (type, "text", "*"));
    15431543      if (is_text)
    15441544      {
     
    15551555    if (fallback_charset)
    15561556      tmp.fallback_charset = fallback_charset;
    15571557    if (source)
    1558       g_mime_message_foreach_part (source, get_utf8_body_foreach_part, &tmp);
     1558      g_mime_message_foreach (source, get_utf8_body_foreach_part, &tmp);
    15591559    return tmp.body;
    15601560  }
    15611561}
     
    15711571
    15721572    // fallback character encodings
    15731573    const char * group_charset (_charset.c_str());
    1574     const GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message)));
     1574    GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message)));
    15751575    const char * message_charset (type ? g_mime_content_type_get_parameter (type, "charset") : 0);
    15761576
    15771577    ///
     
    15851585    const std::string reply_to   (get_header (_message, "Reply-To",    message_charset, group_charset));
    15861586    if (is_reply || fup_to=="poster") {
    15871587      const std::string& to (reply_to.empty() ? from : reply_to);
    1588       g_mime_message_add_recipients_from_string (msg, (char*)GMIME_RECIPIENT_TYPE_TO, to.c_str());
     1588      g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.c_str());
    15891589    } else {
    15901590      const std::string& groups (fup_to.empty() ? newsgroups : fup_to);
    1591       g_mime_message_add_header (msg, "Newsgroups", groups.c_str());
     1591      g_mime_object_append_header ((GMimeObject *) msg, "Newsgroups", groups.c_str());
    15921592    }
    15931593
    15941594    // Subject:
    1595     StringView v = g_mime_message_get_header (_message, "Subject");
     1595    StringView v = g_mime_object_get_header ((GMimeObject *) _message, "Subject");
    15961596    std::string h = header_to_utf8 (v, message_charset, group_charset);
    15971597    std::string val (normalize_subject_re (h));
    15981598    if (val.find ("Re:") != 0) // add "Re: " if we don't have one
     
    16011601
    16021602    // attribution lines
    16031603
    1604     const char * cpch = g_mime_message_get_header (_message, "From");
     1604    const char * cpch = g_mime_object_get_header ((GMimeObject *) _message, "From");
    16051605    h = header_to_utf8 (cpch, message_charset, group_charset);
    1606     g_mime_message_add_header (msg, "X-Draft-Attribution-Author", h.c_str());
     1606    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Author", h.c_str());
    16071607
    16081608    cpch = g_mime_message_get_message_id (_message);
    16091609    h = header_to_utf8 (cpch, message_charset, group_charset);
    1610     g_mime_message_add_header (msg, "X-Draft-Attribution-Id", h.c_str());
     1610    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Id", h.c_str());
    16111611
    1612     char * tmp = g_mime_message_get_date_string (_message);
     1612    char * tmp = g_mime_message_get_date_as_string (_message);
    16131613    h = header_to_utf8 (tmp, message_charset, group_charset);
    1614     g_mime_message_add_header (msg, "X-Draft-Attribution-Date", h.c_str());
     1614    g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Date", h.c_str());
    16151615    g_free (tmp);
    16161616
    16171617    // references
    16181618    const char * header = "References";
    1619     v = g_mime_message_get_header (_message, header);
     1619    v = g_mime_object_get_header ((GMimeObject *) _message, header);
    16201620    val.assign (v.str, v.len);
    16211621    if (!val.empty())
    16221622      val += ' ';
     
    16241624    val += g_mime_message_get_message_id (_message);
    16251625    val += ">";
    16261626    val = GNKSA :: trim_references (val);
    1627     g_mime_message_add_header (msg, header, val.c_str());
     1627    g_mime_object_append_header ((GMimeObject *) msg, header, val.c_str());
    16281628
    16291629    ///
    16301630    ///  BODY
     
    16601660    // set the clone's content object with our modified body
    16611661    GMimeStream * stream = g_mime_stream_mem_new ();
    16621662    g_mime_stream_write_string (stream, s.c_str());
    1663     GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_8BIT);
     1663    GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_8BIT);
    16641664    GMimePart * part = g_mime_part_new ();
    16651665    GMimeContentType * new_type = g_mime_content_type_new_from_string ("text/plain; charset=UTF-8");
    1666     g_mime_part_set_content_type (part, new_type);
     1666    g_mime_object_set_content_type ((GMimeObject *) part, new_type);
    16671667    g_mime_part_set_content_object (part, wrapper);
    1668     g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
     1668    g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
    16691669    g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
    16701670    g_object_unref (wrapper);
    16711671    g_object_unref (part);
    16721672    g_object_unref (stream);
    1673 //std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_message_to_string(msg) << ']' << std::endl;
     1673//std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_object_to_string((GMimeObject *) msg) << ']' << std::endl;
    16741674  }
    16751675
    16761676  return msg;
  • pan/gui/body-pane.h

    diff -Naur pan-0.133.orig/pan/gui/body-pane.h pan-0.133/pan/gui/body-pane.h
    old new  
    8686      void append_part (GMimeObject*, GtkAllocation*);
    8787      static gboolean expander_activated_idle (gpointer self);
    8888      static void expander_activated_cb (GtkExpander*, gpointer self);
    89       static void foreach_part_cb (GMimeObject*, gpointer self);
     89      static void foreach_part_cb (GMimeObject*, GMimeObject*, gpointer self);
    9090      static void text_size_allocated (GtkWidget*, GtkAllocation*, gpointer);
    9191      static gboolean text_size_allocated_idle_cb (gpointer p);
    9292      void text_size_allocated_idle ();
  • pan/gui/gui.cc

    diff -Naur pan-0.133.orig/pan/gui/gui.cc pan-0.133/pan/gui/gui.cc
    old new  
    3131#include <pan/general/file-util.h>
    3232#include <pan/general/macros.h>
    3333#include <pan/usenet-utils/scorefile.h>
     34#include <pan/usenet-utils/mime-utils.h>
    3435#include <pan/tasks/task-article.h>
    3536#include <pan/tasks/task-groups.h>
    3637#include <pan/tasks/task-xover.h>
     
    567568                         ArticleCache& c, const Article& a, const std::string& path):
    568569      _data(d), _queue(q), _root(r), _prefs(p), _cache(c), _article(a), _path(path) {}
    569570
    570     static void foreach_part_cb (GMimeObject *o, gpointer self)
     571    static void foreach_part_cb (GMimeObject * /*parent*/, GMimeObject *o, gpointer self)
    571572    {
    572573      static_cast<SaveArticlesFromNZB*>(self)->foreach_part (o);
    573574    }
     
    591592        if (!tasks.empty())
    592593          _queue.add_tasks (tasks, Queue::BOTTOM);
    593594        g_object_unref (mem_stream);
    594         g_object_unref (wrapper);
     595//        g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
    595596      }
    596597    }
    597598
     
    601602    {
    602603      if (status == OK) {
    603604        GMimeMessage * message = _cache.get_message (_article.get_part_mids());
    604         g_mime_message_foreach_part (message, foreach_part_cb, this);
     605        g_mime_message_foreach (message, foreach_part_cb, this);
    605606        g_object_unref (message);
    606607      }
    607608      delete this;
     
    10411042  const char * cpch;
    10421043  char * old_mid (g_strdup_printf ("<%s>", g_mime_message_get_message_id(message)));
    10431044  GMimeMessage * new_message (g_mime_message_new (false));
    1044   g_mime_message_set_header (new_message, "Supersedes", old_mid);
     1045  g_mime_object_set_header ((GMimeObject *) new_message, "Supersedes", old_mid);
    10451046  g_mime_message_set_sender (new_message, g_mime_message_get_sender (message));
    10461047  g_mime_message_set_subject (new_message, g_mime_message_get_subject (message));
    1047   g_mime_message_set_header (new_message, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
    1048   g_mime_message_set_header (new_message, "References", g_mime_message_get_header (message, "References"));
     1048  g_mime_object_set_header ((GMimeObject *) new_message, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
     1049  g_mime_object_set_header ((GMimeObject *) new_message, "References", g_mime_object_get_header ((GMimeObject *) message, "References"));
    10491050  if ((cpch = g_mime_message_get_reply_to (message)))
    10501051              g_mime_message_set_reply_to (new_message, cpch);
    1051   if ((cpch = g_mime_message_get_header (message,     "Followup-To")))
    1052               g_mime_message_set_header (new_message, "Followup-To", cpch);
     1052  if ((cpch = g_mime_object_get_header ((GMimeObject *) message,     "Followup-To")))
     1053    g_mime_object_set_header ((GMimeObject *) new_message, "Followup-To", cpch);
    10531054  gboolean  unused (false);
    1054   char * body (g_mime_message_get_body (message, true, &unused));
     1055  char * body (g_mime_message_get_body (message, &unused));
    10551056  GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
    1056   GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
     1057  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
    10571058  GMimePart * part = g_mime_part_new ();
    10581059  g_mime_part_set_content_object (part, content_object);
    10591060  g_mime_message_set_mime_part (new_message, GMIME_OBJECT(part));
     
    11111112  char * cancel_message = g_strdup_printf ("cancel <%s>", g_mime_message_get_message_id(message));
    11121113  g_mime_message_set_sender (cancel, g_mime_message_get_sender (message));
    11131114  g_mime_message_set_subject (cancel, "Cancel");
    1114   g_mime_message_set_header (cancel, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
    1115   g_mime_message_set_header (cancel, "Control", cancel_message);
     1115  g_mime_object_set_header ((GMimeObject *) cancel, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
     1116  g_mime_object_set_header ((GMimeObject *) cancel, "Control", cancel_message);
    11161117  const char * body ("Ignore\r\nArticle canceled by author using " PACKAGE_STRING "\r\n");
    11171118  GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
    1118   GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
     1119  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
    11191120  GMimePart * part = g_mime_part_new ();
    11201121  g_mime_part_set_content_object (part, content_object);
    11211122  g_mime_message_set_mime_part (cancel, GMIME_OBJECT(part));
     
    11941195      newsgroups = group;
    11951196  }
    11961197  if (!newsgroups.empty())
    1197     g_mime_message_add_header (message, "Newsgroups", newsgroups.c_str());
     1198    g_mime_object_append_header ((GMimeObject *) message, "Newsgroups", newsgroups.c_str());
    11981199
    11991200  // content type
    12001201  GMimePart * part = g_mime_part_new ();
    1201   g_mime_part_set_content_type (part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
    1202   g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
     1202  g_mime_object_set_content_type ((GMimeObject *) part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
     1203  g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
    12031204  g_mime_message_set_mime_part (message, GMIME_OBJECT(part));
    12041205  g_object_unref (part);
    12051206
     
    17541755    g_snprintf (str, sizeof(str), "%s: %u/%u", _("Tasks"), running, size);
    17551756
    17561757  // build the tooltip
    1757   gulong queued, unused, stopped;
    1758   guint64 KiB_remain;
     1758  long unsigned int queued, unused, stopped;  //SKG MacPorts can't find function
     1759  uint64_t KiB_remain;                        //SKG using gulong and guint64 types.
    17591760  double KiBps;
    17601761  int hr, min, sec;
    17611762  _queue.get_stats (queued, unused, stopped,
  • pan/gui/pan.cc

    diff -Naur pan-0.133.orig/pan/gui/pan.cc pan-0.133/pan/gui/pan.cc
    old new  
    211211  textdomain (GETTEXT_PACKAGE);
    212212
    213213  g_thread_init (0);
    214   g_mime_init (GMIME_INIT_FLAG_UTF8);
     214  g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
    215215
    216216  bool gui(true), nzb(false);
    217217  std::string url;
  • pan/gui/post-ui.cc

    diff -Naur pan-0.133.orig/pan/gui/post-ui.cc pan-0.133/pan/gui/post-ui.cc
    old new  
    529529{
    530530  std::string url, to, groups;
    531531  gboolean unused;
    532   char * headers (g_mime_message_get_headers (message));
    533   char * body (g_mime_message_get_body (message, true, &unused));
     532  char * headers (g_mime_object_get_headers ((GMimeObject *) message));
     533  char * body (g_mime_message_get_body (message, &unused));
    534534  StringView key, val, v(headers);
    535535  v.trim ();
    536536  while (v.pop_token (val, '\n') && val.pop_token(key,':')) {
     
    629629  *** If this is email only, skip the rest of the posting...
    630630  *** we only stayed this long to get check_message()
    631631  **/
    632   const StringView groups (g_mime_message_get_header (message, "Newsgroups"));
     632  const StringView groups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
    633633  if (groups.empty()) {
    634634    maybe_mail_message (message);
    635635    return true;
     
    903903   */
    904904  void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
    905905  {
    906     g_mime_message_add_header (msg, "Message-ID", mid);
     906    g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
    907907    char * bracketed = g_strdup_printf ("<%s>", mid);
    908     g_mime_header_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
     908    g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
    909909    g_free (bracketed);
    910910  }
    911911}
     
    928928  // headers from the ui: To
    929929  const StringView to (gtk_entry_get_text (GTK_ENTRY(_to_entry)));
    930930  if (!to.empty())
    931     g_mime_message_add_recipients_from_string (msg, (char*)GMIME_RECIPIENT_TYPE_TO, to.str);
     931    g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.str);
    932932
    933933  // headers from the ui: Newsgroups
    934934  const StringView groups (gtk_entry_get_text (GTK_ENTRY(_groups_entry)));
    935935  if (!groups.empty())
    936     g_mime_message_set_header (msg, "Newsgroups", groups.str);
     936    g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", groups.str);
    937937
    938938  // headers from the ui: Followup-To
    939939  const StringView followupto (gtk_entry_get_text (GTK_ENTRY(_followupto_entry)));
    940940  if (!followupto.empty())
    941     g_mime_message_set_header (msg, "Followup-To", followupto.str);
     941    g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", followupto.str);
    942942
    943943  // headers from the ui: Reply-To
    944944  const StringView replyto (gtk_entry_get_text (GTK_ENTRY(_replyto_entry)));
    945945  if (!replyto.empty())
    946     g_mime_message_set_header (msg, "Reply-To", replyto.str);
     946    g_mime_object_set_header ((GMimeObject *) msg, "Reply-To", replyto.str);
    947947
    948948  // add the 'hidden headers'
    949949  foreach_const (str2str_t, _hidden_headers, it)
    950950    if ((mode==DRAFTING) || (it->first.find ("X-Draft-")!=0))
    951       g_mime_message_set_header (msg, it->first.c_str(), it->second.c_str());
     951      g_mime_object_set_header ((GMimeObject *) msg, it->first.c_str(), it->second.c_str());
    952952
    953953  // build headers from the 'more headers' entry field
    954954  std::map<std::string,std::string> headers;
     
    964964    val.trim ();
    965965    std::string key_str (key.to_string());
    966966    if (extra_header_is_editable (key, val))
    967       g_mime_message_set_header (msg, key.to_string().c_str(),
    968                                       val.to_string().c_str());
     967      g_mime_object_set_header ((GMimeObject *) msg, key.to_string().c_str(),
     968                                val.to_string().c_str());
    969969  }
    970970  g_free (pch);
    971971
    972972  // User-Agent
    973973  if (mode==POSTING && _prefs.get_flag (USER_AGENT_PREFS_KEY, true))
    974     g_mime_message_set_header (msg, "User-Agent", get_user_agent());
     974    g_mime_object_set_header ((GMimeObject *) msg, "User-Agent", get_user_agent());
    975975
    976976  // Message-ID
    977977  if (mode==POSTING && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) {
     
    987987  const std::string charset ((mode==POSTING && !_charset.empty()) ? _charset : "UTF-8");
    988988  if (charset != "UTF-8") {
    989989    // add a wrapper to convert from UTF-8 to $charset
    990     GMimeStream * tmp = g_mime_stream_filter_new_with_stream (stream);
     990    GMimeStream * tmp = g_mime_stream_filter_new (stream);
    991991    g_object_unref (stream);
    992992    GMimeFilter * filter = g_mime_filter_charset_new ("UTF-8", charset.c_str());
    993993    g_mime_stream_filter_add (GMIME_STREAM_FILTER(tmp), filter);
    994994    g_object_unref (filter);
    995995    stream = tmp;
    996996  }
    997   GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
     997  GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
    998998  g_object_unref (stream);
    999999  GMimePart * part = g_mime_part_new ();
    10001000  pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
    10011001  GMimeContentType * type = g_mime_content_type_new_from_string (pch);
    10021002  g_free (pch);
    1003   g_mime_part_set_content_type (part, type); // part owns type now. type isn't refcounted.
     1003  g_mime_object_set_content_type ((GMimeObject *) part, type); // part owns type now. type isn't refcounted.
    10041004  g_mime_part_set_content_object (part, content_object);
    1005   g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
     1005  g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
    10061006  g_object_unref (content_object);
    10071007  g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
    10081008  g_object_unref (part);
     
    10361036
    10371037    errno = 0;
    10381038    std::ofstream o (filename);
    1039     char * pch = g_mime_message_to_string (msg);
     1039    char * pch = g_mime_object_to_string ((GMimeObject *) msg);
    10401040    o << pch;
    10411041    o.close ();
    10421042
     
    15041504  std::string s = utf8ize (g_mime_message_get_subject (message));
    15051505  gtk_entry_set_text (GTK_ENTRY(_subject_entry), s.c_str());
    15061506
    1507   s = utf8ize (g_mime_message_get_header (message, "Newsgroups"));
     1507  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
    15081508  gtk_entry_set_text (GTK_ENTRY(_groups_entry), s.c_str());
    15091509
    1510   s = utf8ize (g_mime_message_get_header (message, "Followup-To"));
     1510  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
    15111511  gtk_entry_set_text (GTK_ENTRY(_followupto_entry), s.c_str());
    15121512
    1513   s = utf8ize (g_mime_message_get_header (message, "Reply-To"));
     1513  s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
    15141514  gtk_entry_set_text (GTK_ENTRY(_replyto_entry), s.c_str());
    15151515
    1516   const InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
     1516  InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
    15171517  char * pch  = internet_address_list_to_string (addresses, true);
    15181518  s = utf8ize (pch);
    15191519  gtk_entry_set_text (GTK_ENTRY(_to_entry), s.c_str());
     
    15211521
    15221522  // update 'other headers'
    15231523  SetMessageForeachHeaderData data;
    1524   if (message->mime_part && g_mime_header_has_raw (message->mime_part->headers))
    1525     g_mime_header_foreach (message->mime_part->headers, set_message_foreach_header_func, &data);
    1526   g_mime_header_foreach (GMIME_OBJECT(message)->headers, set_message_foreach_header_func, &data);
     1524  const char *name, *value;
     1525  GMimeHeaderIter iter;
     1526 
     1527  if (message->mime_part && g_mime_header_list_has_raw (message->mime_part->headers)) {
     1528    if (g_mime_header_list_get_iter (message->mime_part->headers, &iter)) {
     1529      do {
     1530        value = g_mime_header_iter_get_value (&iter);
     1531        name = g_mime_header_iter_get_name (&iter);
     1532        set_message_foreach_header_func (name, value, &data);
     1533      } while (g_mime_header_iter_next (&iter));
     1534    }
     1535  }
     1536 
     1537  if (g_mime_header_list_get_iter (GMIME_OBJECT (message)->headers, &iter)) {
     1538    do {
     1539      value = g_mime_header_iter_get_value (&iter);
     1540      name = g_mime_header_iter_get_name (&iter);
     1541      set_message_foreach_header_func (name, value, &data);
     1542    } while (g_mime_header_iter_next (&iter));
     1543  }
     1544 
    15271545  s = utf8ize (data.visible_headers);
    15281546  gtk_text_buffer_set_text (_headers_buf, s.c_str(), -1);
    15291547  _hidden_headers = data.hidden_headers;
    15301548
    15311549  // update body
    15321550  int ignored;
    1533   char * tmp = g_mime_message_get_body (message, true, &ignored);
     1551  char * tmp = g_mime_message_get_body (message, &ignored);
    15341552  s = utf8ize (tmp);
    15351553  g_free (tmp);
    15361554  if (!s.empty()) {
  • pan/tasks/nntp.cc

    diff -Naur pan-0.133.orig/pan/tasks/nntp.cc pan-0.133/pan/tasks/nntp.cc
    old new  
    2020#include <config.h>
    2121#include <cassert>
    2222#include <cstdarg>
     23#include <cstdio>
    2324#include <cstdlib> // abort, atoi, strtoul
    2425extern "C" {
    2526  #include <glib.h>
  • pan/tasks/nntp-pool.cc

    diff -Naur pan-0.133.orig/pan/tasks/nntp-pool.cc pan-0.133/pan/tasks/nntp-pool.cc
    old new  
    1818 */
    1919
    2020#include <config.h>
     21#include <cstdio>
    2122#include <ctime>
    2223#include <glib/gi18n.h>
    2324#include <pan/general/debug.h>
  • pan/usenet-utils/message-check.cc

    diff -Naur pan-0.133.orig/pan/usenet-utils/message-check.cc pan-0.133/pan/usenet-utils/message-check.cc
    old new  
    3030#include "gnksa.h"
    3131#include "message-check.h"
    3232#include "text-massager.h"
     33#include "mime-utils.h"
    3334
    3435using namespace pan;
    3536
     
    6263      std::string body (body_in.to_string());
    6364
    6465      // strip attribution
    65       const char * attribution = g_mime_message_get_header (message, PAN_ATTRIBUTION);
     66      const char * attribution = g_mime_object_get_header ((GMimeObject *) message, PAN_ATTRIBUTION);
    6667      if (attribution && *attribution)
    6768      {
    6869         std::string::size_type attrib_start_pos = body.find (attribution);
     
    99100                    GMimeMessage           * message)
    100101  {
    101102    // if it's not a reply, then top-posting check is moot
    102     if (g_mime_message_get_header (message, "References") == NULL)
     103    if (g_mime_object_get_header ((GMimeObject *) message, "References") == NULL)
    103104      return;
    104105
    105106    bool quoted_found (false);
     
    414415  }
    415416}
    416417
    417 
    418418void
    419419MessageCheck :: message_check (const GMimeMessage * message_const,
    420420                               const StringView   & attribution,
     
    432432  check_subject (errors, goodness, g_mime_message_get_subject (message));
    433433
    434434  // check the author...
    435   if (GNKSA::check_from (g_mime_message_get_header (message, "From"), true)) {
     435  if (GNKSA::check_from (g_mime_object_get_header ((GMimeObject *) message, "From"), true)) {
    436436    errors.insert (_("Error: Bad email address."));
    437437    goodness.raise_to_warn ();
    438438  }
     
    440440  // check the body...
    441441  TextMassager tm;
    442442  gboolean is_html;
    443   char * body = g_mime_message_get_body (message, true, &is_html);
     443  char * body = g_mime_message_get_body (message, &is_html);
    444444  if (is_html) {
    445445    errors.insert (_("Warning: Most newsgroups frown upon HTML posts."));
    446446    goodness.raise_to_warn ();
    447447  }
    448448  check_body (errors, goodness, tm, message, body, attribution);
    449449  g_free (body);
    450 
     450 
    451451  // check the optional followup-to...
    452452  bool followup_to_set (false);
    453   const char * cpch = g_mime_message_get_header (message, "Followup-To");
     453  const char * cpch = g_mime_object_get_header ((GMimeObject *) message, "Followup-To");
    454454  if (cpch && *cpch) {
    455455    quarks_t groups;
    456456    get_nntp_rcpts (cpch, groups);
     
    460460
    461461  // check the groups...
    462462  size_t group_qty (0);
    463   cpch = g_mime_message_get_header (message, "Newsgroups");
     463  cpch = g_mime_object_get_header ((GMimeObject *) message, "Newsgroups");
    464464  if (cpch && *cpch) {
    465465    quarks_t groups;
    466466    get_nntp_rcpts (cpch, groups);
     
    469469  }
    470470
    471471  // one last error check
    472   const InternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO));
     472  InternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO));
    473473  const int n_to (internet_address_list_length (list));
    474474  if (!group_qty && !n_to) {
    475475    errors.insert (_("Error: No Recipients."));
  • pan/usenet-utils/message-check-test.cc

    diff -Naur pan-0.133.orig/pan/usenet-utils/message-check-test.cc pan-0.133/pan/usenet-utils/message-check-test.cc
    old new  
    2222      std::cerr << LINE_ID << " [" << i << "][" << *it << ']' << std::endl; \
    2323  }
    2424
     25static void
     26mime_part_set_content (GMimePart *part, const char *str)
     27{
     28        GMimeDataWrapper *content;
     29        GMimeStream *stream;
     30       
     31        stream = g_mime_stream_mem_new_with_buffer (str, strlen (str));
     32        content = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
     33        g_object_unref (stream);
     34       
     35        g_mime_part_set_content_object (part, content);
     36        g_object_unref (content);
     37}
     38
    2539int main (void)
    2640{
    2741  g_mime_init (0);
     
    4155  std::string message_id = GNKSA :: generate_message_id ("rebelbase.com");
    4256  g_mime_message_set_message_id (msg, message_id.c_str());
    4357  g_mime_message_set_subject (msg, "MAKE MONEY FAST");
    44   g_mime_message_set_header (msg, "Organization", "Lazars Android Works");
    45   g_mime_message_set_header (msg, "Newsgroups", "alt.test");
     58  g_mime_object_set_header ((GMimeObject *) msg, "Organization", "Lazars Android Works");
     59  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
    4660  GMimePart * part = g_mime_part_new_with_type ("text", "plain");
    4761  const char * cpch = "Hello World!";
    48   g_mime_part_set_content (part, cpch, strlen(cpch));
     62  mime_part_set_content (part, cpch);
    4963  g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
    5064  // this should pass the tests
    5165  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
     
    5468
    5569  // all quoted
    5670  cpch = "> Hello World!\n> All quoted text.";
    57   g_mime_part_set_content (part, cpch, strlen(cpch));
     71  mime_part_set_content (part, cpch);
    5872  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    5973  std::vector<std::string> e (errors.begin(), errors.end());
    6074  check (errors.size() == 2)
     
    6478
    6579  // mostly quoted
    6680  cpch = "> Hello World!\n> quoted\n> text\n> foo\n> bar\nnew text";
    67   g_mime_part_set_content (part, cpch, strlen(cpch));
     81  mime_part_set_content (part, cpch);
    6882  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    6983  e.assign (errors.begin(), errors.end());
    7084  check (errors.size() == 1)
     
    7387
    7488  // mostly quoted border condition: 20% of message is new content (should pass)
    7589  cpch = "> Hello World!\n> quoted\n> text\n> foo\nnew text";
    76   g_mime_part_set_content (part, cpch, strlen(cpch));
     90  mime_part_set_content (part, cpch);
    7791  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    7892  check (errors.empty())
    7993  check (goodness.is_ok())
    8094
    8195  // sig check: too long
    8296  cpch = "Hello!\n\n-- \nThis\nSig\nIs\nToo\nLong\n";
    83   g_mime_part_set_content (part, cpch, strlen(cpch));
     97  mime_part_set_content (part, cpch);
    8498  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    8599  e.assign (errors.begin(), errors.end());
    86100  check (errors.size() == 1)
     
    95109         "This sig line is greater than 80 characters wide.  In fact, it's 84 characters wide.\n"
    96110         "This sig line is greater than 80 characters wide.  In fact, it measures 95 characters in width!\n"
    97111         "This sig line is less than 80 characters wide.";
    98   g_mime_part_set_content (part, cpch, strlen(cpch));
     112  mime_part_set_content (part, cpch);
    99113  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    100114  e.assign (errors.begin(), errors.end());
    101115  check (errors.size() == 1)
     
    104118
    105119  // sig check: sig marker, no sig
    106120  cpch = "Hello!\n\n-- \n";
    107   g_mime_part_set_content (part, cpch, strlen(cpch));
     121  mime_part_set_content (part, cpch);
    108122  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    109123  e.assign (errors.begin(), errors.end());
    110124  check (errors.size() == 1)
     
    113127
    114128  // sig check: okay sig
    115129  cpch = "Hello!\n\n-- \nThis is a short, narrow sig.\nIt should pass.\n";
    116   g_mime_part_set_content (part, cpch, strlen(cpch));
     130  mime_part_set_content (part, cpch);
    117131  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    118132  check (errors.empty())
    119133  check (goodness.is_ok())
     
    146160         "This sig line is greater than 80 characters wide.  In fact, it's 84 characters wide.\n"
    147161         "This sig line is greater than 80 characters wide.  In fact, it measures 95 characters in width!\n"
    148162         "This sig line is less than 80 characters wide.";
    149   g_mime_part_set_content (part, cpch, strlen(cpch));
     163  mime_part_set_content (part, cpch);
    150164  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    151165  e.assign (errors.begin(), errors.end());
    152166  check (errors.size() == 1)
     
    155169
    156170  // body empty
    157171  cpch = "\n\t\n   \n-- \nThis is the sig.";
    158   g_mime_part_set_content (part, cpch, strlen(cpch));
     172  mime_part_set_content (part, cpch);
    159173  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    160174  e.assign (errors.begin(), errors.end());
    161175  check (errors.size() == 2)
     
    163177  check (e[0] == "Error: Message appears to have no new content.");
    164178  check (e[1] == "Error: Message is empty.");
    165179  cpch = "Some valid message.";
    166   g_mime_part_set_content (part, cpch, strlen(cpch));
     180  mime_part_set_content (part, cpch);
    167181
    168182  // empty subject
    169183  g_mime_message_set_subject (msg, "");
     
    175189  g_mime_message_set_subject (msg, "Happy Lucky Feeling");
    176190
    177191  // newsgroups
    178   g_mime_message_set_header (msg, "Newsgroups", "alt.test,unknown.group");
     192  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,unknown.group");
    179193  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    180194  e.assign (errors.begin(), errors.end());
    181195  check (errors.size() == 1)
    182196  check (goodness.is_warn())
    183197  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\".")
    184   g_mime_message_set_header (msg, "Newsgroups", "alt.test");
     198          g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
    185199
    186200  // newsgroups w/o followup
    187   g_mime_message_set_header (msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
    188   g_mime_header_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
     201  g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
     202  g_mime_header_list_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
    189203  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    190204  e.assign (errors.begin(), errors.end());
    191205  check (errors.size() == 1)
     
    193207  check (e[0] == "Warning: Crossposting without setting Followup-To header.")
    194208
    195209  // unknown follow-up
    196   g_mime_message_set_header (msg, "Newsgroups", "alt.test");
    197   g_mime_message_set_header (msg, "Followup-To", "alt.test,unknown.group");
     210          g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
     211  g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", "alt.test,unknown.group");
    198212  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    199213  e.assign (errors.begin(), errors.end());
    200214  check (errors.size() == 1)
     
    203217  g_mime_object_remove_header (GMIME_OBJECT(msg), "Followup-To");
    204218
    205219  // top posting
    206   g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
     220  g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf at foo.com <http://lists.macosforge.org/mailman/listinfo.cgi/macports-changes>>");
    207221  cpch = "How Fascinating!\n"
    208222         "\n"
    209223         "> Blah blah blah.\n";
    210   g_mime_part_set_content (part, cpch, strlen(cpch));
     224  mime_part_set_content (part, cpch);
    211225  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    212226  e.assign (errors.begin(), errors.end());
    213227  check (errors.size() == 1)
     
    216230  g_mime_object_remove_header (GMIME_OBJECT(msg), "References");
    217231
    218232  // top posting
    219   g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
     233  g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf at foo.com <http://lists.macosforge.org/mailman/listinfo.cgi/macports-changes>>");
    220234  cpch = "How Fascinating!\n"
    221235         "\n"
    222236         "> Blah blah blah.\n"
     
    224238         "-- \n"
    225239         "Pan shouldn't mistake this signature for\n"
    226240         "original content in the top-posting check.\n";
    227   g_mime_part_set_content (part, cpch, strlen(cpch));
     241  mime_part_set_content (part, cpch);
    228242  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    229243  e.assign (errors.begin(), errors.end());
    230244  check (errors.size() == 1)
     
    238252         "\n"
    239253         "--\n"
    240254         "This is my signature.\n";
    241   g_mime_part_set_content (part, cpch, strlen(cpch));
     255  mime_part_set_content (part, cpch);
    242256  MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
    243257  e.assign (errors.begin(), errors.end());
    244258  check (errors.size() == 1)
  • pan/usenet-utils/mime-utils.cc

    diff -Naur pan-0.133.orig/pan/usenet-utils/mime-utils.cc pan-0.133/pan/usenet-utils/mime-utils.cc
    old new  
    455455      part->stream = g_mime_stream_mem_new ();
    456456      if (part->type != ENC_PLAIN) {
    457457        part->filter_stream =
    458           g_mime_stream_filter_new_with_stream (part->stream);
     458          g_mime_stream_filter_new (part->stream);
    459459        part->filter = part->type == ENC_UU
    460           ? g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC)
    461           : g_mime_filter_yenc_new (GMIME_FILTER_YENC_DIRECTION_DECODE);
     460          ? g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_UUENCODE, FALSE)
     461          : g_mime_filter_yenc_new (FALSE);
    462462        g_mime_stream_filter_add (GMIME_STREAM_FILTER(part->filter_stream),
    463463                                  part->filter);
    464464      }
     
    722722  {
    723723    // if the part is a multipart, check its subparts
    724724    if (GMIME_IS_MULTIPART (*part)) {
    725       GList * subparts = GMIME_MULTIPART (*part)->subparts;
    726       while (subparts) {
    727         GMimeObject * subpart = (GMimeObject *) subparts->data;
     725      GMimeMultipart *multipart = (GMimeMultipart *) *part;
     726      int count = g_mime_multipart_get_count(multipart);
     727      int i;
     728     
     729      for (i = 0; i < count; i++) {
     730        GMimeObject * subpart = g_mime_multipart_remove_at (multipart, i);
    728731        handle_uu_and_yenc_in_text_plain (&subpart);
    729         subparts->data = subpart;
    730         subparts = subparts->next;
     732        g_mime_multipart_insert (multipart, i, subpart);
     733        g_object_unref (subpart);
    731734      }
    732735      return;
    733736    }
    734737
    735738    // we assume that inlined yenc and uu are only in text/plain blocks
    736     const GMimeContentType * content_type = g_mime_object_get_content_type (*part);
     739    GMimeContentType * content_type = g_mime_object_get_content_type (*part);
    737740    if (!g_mime_content_type_is_type (content_type, "text", "plain"))
    738741      return;
    739742
     
    746749    GMimeStream * stream = g_mime_data_wrapper_get_stream (content);
    747750    g_mime_stream_reset (stream);
    748751    GMimeStream * istream = g_mime_stream_buffer_new (stream, GMIME_STREAM_BUFFER_BLOCK_READ);
    749     g_object_unref (stream);
    750     g_object_unref (content);
     752//    g_object_unref (stream); //SKG if this is unrefed, when istream is unrefed below, content loses its stream
     753//    g_object_unref (content); //SKG gmime 2.4 don't unref returned data wrapper
    751754
    752755    // break it into separate parts for text, uu, and yenc pieces.
    753756    temp_parts_t parts;
     
    774777          g_mime_part_set_filename (subpart, filename);
    775778
    776779        GMimeStream * subpart_stream = tmp_part->stream;
    777         content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_PART_ENCODING_DEFAULT);
     780        content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_CONTENT_ENCODING_DEFAULT);
    778781        g_mime_part_set_content_object (subpart, content);
    779         g_mime_multipart_add_part (GMIME_MULTIPART (multipart), GMIME_OBJECT (subpart));
     782        g_mime_multipart_add (GMIME_MULTIPART (multipart), GMIME_OBJECT (subpart));
    780783
    781784        g_object_unref (content);
    782785        g_object_unref (subpart);
    783786      }
    784787               
    785788      // replace the old part with the new multipart
    786       g_mime_object_unref (*part);
     789      g_object_unref (*part);
    787790      *part = GMIME_OBJECT (multipart);
    788791    }
    789792
    790793    foreach (temp_parts_t, parts, it)
    791794      delete *it;
    792     g_mime_stream_unref (istream);
     795    g_object_unref (istream);
    793796  }
    794797}
    795798
     
    831834      GMimeStream * stream = g_mime_data_wrapper_get_stream (wrapper);
    832835      g_mime_stream_reset (stream);
    833836      g_mime_stream_cat_add_source (GMIME_STREAM_CAT (cat), stream);
    834       g_object_unref (stream);
    835       g_object_unref (wrapper);
     837//      g_object_unref (stream); //SKG if this is unrefed cat loses its stream
     838//      g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
    836839    }
    837840
    838841    GMimeMessage * message = messages[0];
    839842    GMimeDataWrapper * wrapper = g_mime_part_get_content_object (GMIME_PART(message->mime_part));
    840843    g_mime_stream_reset (cat);
    841844    g_mime_data_wrapper_set_stream (wrapper, cat);
    842     g_object_unref (wrapper);
     845//    g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
    843846    g_object_unref (cat);
    844847  }
    845848
     
    10071010{
    10081011  normalize_subject (subject, STRIP_MULTIPART_NUMERATOR, setme);
    10091012}
     1013
     1014static GMimeObject *
     1015handle_multipart_mixed (GMimeMultipart *multipart, gboolean *is_html);
     1016
     1017static GMimeObject *
     1018handle_multipart_alternative (GMimeMultipart *multipart, gboolean *is_html)
     1019{
     1020        GMimeObject *mime_part, *text_part = NULL;
     1021        GMimeContentType *type;
     1022        int count = g_mime_multipart_get_count (multipart);
     1023
     1024        for (int i = 0; i < count; ++i) {
     1025                mime_part = g_mime_multipart_get_part (multipart, i);
     1026
     1027                type = g_mime_object_get_content_type (mime_part);
     1028                if (g_mime_content_type_is_type (type, "text", "*")) {
     1029                        if (!text_part || !g_ascii_strcasecmp (type->subtype, "plain")) {
     1030                                *is_html = !g_ascii_strcasecmp (type->subtype, "html");
     1031                                text_part = mime_part;
     1032                        }
     1033                }
     1034        }
     1035
     1036        return text_part;
     1037}
     1038
     1039static GMimeObject *
     1040handle_multipart_mixed (GMimeMultipart *multipart, gboolean *is_html)
     1041{
     1042        GMimeObject *mime_part, *text_part = NULL;
     1043        GMimeContentType *type, *first_type = NULL;
     1044        int count = g_mime_multipart_get_count (multipart);
     1045
     1046        for (int i = 0; i < count; ++i) {
     1047                mime_part = g_mime_multipart_get_part (multipart, i);
     1048
     1049                type = g_mime_object_get_content_type (mime_part);
     1050                if (GMIME_IS_MULTIPART (mime_part)) {
     1051                        multipart = GMIME_MULTIPART (mime_part);
     1052                        if (g_mime_content_type_is_type (type, "multipart", "alternative")) {
     1053                                mime_part = handle_multipart_alternative (multipart, is_html);
     1054                                if (mime_part)
     1055                                        return mime_part;
     1056                        } else {
     1057                                mime_part = handle_multipart_mixed (multipart, is_html);
     1058                                if (mime_part && !text_part)
     1059                                        text_part = mime_part;
     1060                        }
     1061                } else if (g_mime_content_type_is_type (type, "text", "*")) {
     1062                        if (!g_ascii_strcasecmp (type->subtype, "plain")) {
     1063                                /* we got what we came for */
     1064                                *is_html = !g_ascii_strcasecmp (type->subtype, "html");
     1065                                return mime_part;
     1066                        }
     1067
     1068                        /* if we haven't yet found a text part or if it is a type we can
     1069 *                          * understand and it is the first of that type, save it */
     1070                        if (!text_part || (!g_ascii_strcasecmp (type->subtype, "plain") && (first_type &&
     1071                                           g_ascii_strcasecmp (type->subtype, first_type->subtype) != 0))) {
     1072                                *is_html = !g_ascii_strcasecmp (type->subtype, "html");
     1073                                text_part = mime_part;
     1074                                first_type = type;
     1075                        }
     1076                }
     1077        }
     1078
     1079        return text_part;
     1080}
     1081
     1082#define NEEDS_DECODING(encoding) ((encoding == GMIME_CONTENT_ENCODING_BASE64) ||   \
     1083                                  (encoding == GMIME_CONTENT_ENCODING_UUENCODE) || \
     1084                                  (encoding == GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE))
     1085
     1086static const char *
     1087g_mime_part_get_content (const GMimePart *mime_part, size_t *len)
     1088{
     1089        const char *retval = NULL;
     1090        GMimeStream *stream;
     1091
     1092        g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
     1093
     1094        if (!mime_part->content || !mime_part->content->stream) {
     1095                g_warning ("no content set on this mime part");
     1096                return NULL;
     1097        }
     1098
     1099        stream = mime_part->content->stream;
     1100        if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) {
     1101                /* Decode and cache this mime part's contents... */
     1102                GMimeStream *cache;
     1103                GByteArray *buf;
     1104
     1105                buf = g_byte_array_new ();
     1106                cache = g_mime_stream_mem_new_with_byte_array (buf);
     1107
     1108                g_mime_data_wrapper_write_to_stream (mime_part->content, cache);
     1109
     1110                g_mime_data_wrapper_set_stream (mime_part->content, cache);
     1111                g_mime_data_wrapper_set_encoding (mime_part->content, GMIME_CONTENT_ENCODING_DEFAULT);
     1112                g_object_unref (cache);
     1113
     1114                *len = buf->len;
     1115                retval = (char *) buf->data;
     1116        } else {
     1117                GByteArray *buf = GMIME_STREAM_MEM (stream)->buffer;
     1118                off_t end_index = (off_t) buf->len;
     1119                off_t start_index = 0;
     1120
     1121                /* check boundaries */
     1122                if (stream->bound_start >= 0)
     1123                        start_index = CLAMP (stream->bound_start, 0, (off_t) buf->len);
     1124                if (stream->bound_end >= 0)
     1125                        end_index = CLAMP (stream->bound_end, 0, (off_t) buf->len);
     1126                if (end_index < start_index)
     1127                        end_index = start_index;
     1128
     1129                *len = end_index - start_index;
     1130                retval = (char *) buf->data + start_index;
     1131        }
     1132
     1133        return retval;
     1134}
     1135
     1136char *g_mime_message_get_body (GMimeMessage *message, gboolean *is_html)
     1137{
     1138        GMimeObject *mime_part = NULL;
     1139        GMimeContentType *type;
     1140        GMimeMultipart *multipart;
     1141        const char *content;
     1142        char *body = NULL;
     1143        size_t len = 0;
     1144
     1145        g_return_val_if_fail (GMIME_IS_MESSAGE (message), NULL);
     1146        g_return_val_if_fail (is_html != NULL, NULL);
     1147
     1148        type = g_mime_object_get_content_type (message->mime_part);
     1149        if (GMIME_IS_MULTIPART (message->mime_part)) {
     1150                /* let's see if we can find a body in the multipart */
     1151                multipart = GMIME_MULTIPART (message->mime_part);
     1152                if (g_mime_content_type_is_type (type, "multipart", "alternative"))
     1153                        mime_part = handle_multipart_alternative (multipart, is_html);
     1154                else
     1155                        mime_part = handle_multipart_mixed (multipart, is_html);
     1156        } else if (g_mime_content_type_is_type (type, "text", "*")) {
     1157                /* this *has* to be the message body */
     1158                if (g_mime_content_type_is_type (type, "text", "html"))
     1159                        *is_html = TRUE;
     1160                else
     1161                        *is_html = FALSE;
     1162                mime_part = message->mime_part;
     1163        }
     1164
     1165        if (mime_part != NULL) {
     1166                content = g_mime_part_get_content (GMIME_PART (mime_part), &len);
     1167                body = g_strndup (content, len);
     1168        }
     1169
     1170        return body;
     1171}
     1172
     1173void g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string)
     1174{
     1175        InternetAddressList *addrlist;
     1176        if ((addrlist = internet_address_list_parse_string (string))) {
     1177                for (int i = 0; i < internet_address_list_length (addrlist); ++i) {
     1178                        InternetAddress *ia = internet_address_list_get_address (addrlist, i);
     1179                        if (INTERNET_ADDRESS_IS_MAILBOX(ia))
     1180                                g_mime_message_add_recipient (message, type, internet_address_get_name(ia), internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(ia)));
     1181                }
     1182        }
     1183}
  • pan/usenet-utils/mime-utils.h

    diff -Naur pan-0.133.orig/pan/usenet-utils/mime-utils.h pan-0.133/pan/usenet-utils/mime-utils.h
    old new  
    6464  };
    6565}
    6666
     67char *g_mime_message_get_body (GMimeMessage *message, gboolean *is_html);
     68void g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string);
     69
     70
    6771#endif
  • pan/usenet-utils/numbers.cc

    diff -Naur pan-0.133.orig/pan/usenet-utils/numbers.cc pan-0.133/pan/usenet-utils/numbers.cc
    old new  
    1919
    2020#include <config.h>
    2121#include <cctype>
     22#include <cstdio>
    2223#include <pan/general/string-view.h>
    2324#include "numbers.h"
    2425#include <algorithm>
  • pan.spec

    diff -Naur pan-0.133.orig/pan.spec pan-0.133/pan.spec
    old new  
    1515
    1616BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
    1717BuildRequires: glib2-devel >= 2.4.0
    18 BuildRequires: gmime-devel >= 2.1.9
     18BuildRequires: gmime-devel >= 2.3.5
    1919BuildRequires: gtk2-devel >= 2.4.0
    2020BuildRequires: pcre-devel >= 5.0
    2121%{!?_without_gtkspell:BuildRequires: gtkspell-devel >= 2.0.7}
    2222
    2323Requires: pcre >= 5.0
    2424Requires: glib2 >= 2.4.0
    25 Requires: gmime >= 2.1.9
     25Requires: gmime >= 2.3.5
    2626Requires: gtk2 >= 2.4.0
    2727%{!?_without_gtkspell:Requires: gtkspell >= 2.0.7}
    2828