Ticket #3112: pan-0.133-gmime-gcc.patch
File pan-0.133-gmime-gcc.patch, 58.0 KB (added by , 14 years ago) |
---|
-
configure
diff -Naur pan-0.133.orig/configure pan-0.133/configure
old new 2377 2377 2378 2378 PCRE_REQUIRED=5.0 2379 2379 GLIB_REQUIRED=2.4.0 2380 GMIME_REQUIRED=2. 1.92380 GMIME_REQUIRED=2.3.5 2381 2381 GTK_REQUIRED=2.4.0 2382 2382 GTKSPELL_REQUIRED=2.0.7 2383 2383 … … 7957 7957 pkg_cv_GMIME_CFLAGS="$GMIME_CFLAGS" 7958 7958 elif test -n "$PKG_CONFIG"; then 7959 7959 if test -n "$PKG_CONFIG" && \ 7960 { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2. 0>= \$GMIME_REQUIRED\"") >&57961 ($PKG_CONFIG --exists --print-errors "gmime-2. 0>= $GMIME_REQUIRED") 2>&57960 { (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 7962 7962 ac_status=$? 7963 7963 echo "$as_me:$LINENO: \$? = $ac_status" >&5 7964 7964 (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` 7966 7966 else 7967 7967 pkg_failed=yes 7968 7968 fi … … 7973 7973 pkg_cv_GMIME_LIBS="$GMIME_LIBS" 7974 7974 elif test -n "$PKG_CONFIG"; then 7975 7975 if test -n "$PKG_CONFIG" && \ 7976 { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2. 0>= \$GMIME_REQUIRED\"") >&57977 ($PKG_CONFIG --exists --print-errors "gmime-2. 0>= $GMIME_REQUIRED") 2>&57976 { (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 7978 7978 ac_status=$? 7979 7979 echo "$as_me:$LINENO: \$? = $ac_status" >&5 7980 7980 (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` 7982 7982 else 7983 7983 pkg_failed=yes 7984 7984 fi … … 7996 7996 _pkg_short_errors_supported=no 7997 7997 fi 7998 7998 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` 8000 8000 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` 8002 8002 fi 8003 8003 # Put the nasty error message in config.log where it belongs 8004 8004 echo "$GMIME_PKG_ERRORS" >&5 8005 8005 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: 8007 8007 8008 8008 $GMIME_PKG_ERRORS 8009 8009 … … 8014 8014 and GMIME_LIBS to avoid the need to call pkg-config. 8015 8015 See the pkg-config man page for more details. 8016 8016 " >&5 8017 echo "$as_me: error: Package requirements (gmime-2. 0>= $GMIME_REQUIRED) were not met:8017 echo "$as_me: error: Package requirements (gmime-2.4 >= $GMIME_REQUIRED) were not met: 8018 8018 8019 8019 $GMIME_PKG_ERRORS 8020 8020 -
configure.in
diff -Naur pan-0.133.orig/configure.in pan-0.133/configure.in
old new 18 18 19 19 PCRE_REQUIRED=5.0 20 20 GLIB_REQUIRED=2.4.0 21 GMIME_REQUIRED=2. 1.921 GMIME_REQUIRED=2.3.5 22 22 GTK_REQUIRED=2.4.0 23 23 GTKSPELL_REQUIRED=2.0.7 24 24 AC_SUBST(PCRE_REQUIRED) … … 50 50 51 51 PKG_CHECK_MODULES(PCRE, libpcre >= $PCRE_REQUIRED) 52 52 AM_PATH_GLIB_2_0($GLIB_REQUIRED,,exit 1,gobject gmodule gthread) 53 PKG_CHECK_MODULES(GMIME, gmime-2. 0>= $GMIME_REQUIRED)53 PKG_CHECK_MODULES(GMIME, gmime-2.4 >= $GMIME_REQUIRED) 54 54 AM_PATH_GTK_2_0($GTK_REQUIRED,,exit 1,gthread) 55 55 56 56 -
pan/general/log.cc
diff -Naur pan-0.133.orig/pan/general/log.cc pan-0.133/pan/general/log.cc
old new 20 20 #include <config.h> 21 21 #include <iostream> 22 22 #include <cstdarg> 23 #include <cstdio> 23 24 #include "log.h" 24 25 25 26 using 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 19 19 20 20 #include <config.h> 21 21 #include <cstdarg> 22 #include <cstdio> 22 23 #include "progress.h" 23 24 #include "string-view.h" 24 25 -
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 136 136 { 137 137 std::string s = content_to_utf8 (header, fallback_charset1, fallback_charset2); 138 138 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())); 140 140 s = clean_utf8 (decoded); 141 141 g_free (decoded); 142 142 } … … 147 147 pan :: mime_part_to_utf8 (GMimePart * part, 148 148 const char * fallback_charset) 149 149 { 150 GMimeDataWrapper *content; 151 GMimeStream *stream; 152 const char *charset; 153 GByteArray *buffer; 150 154 std::string ret; 151 155 152 156 g_return_val_if_fail (GMIME_IS_PART(part), ret); 153 157 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); 159 170 160 171 return ret; 161 172 } -
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 837 837 } 838 838 839 839 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 841 841 } 842 842 843 843 // flush the loader … … 874 874 return; 875 875 876 876 GMimePart * part = GMIME_PART (obj); 877 constGMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));877 GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part)); 878 878 879 879 // decide whether or not this part is a picture 880 880 bool is_image (g_mime_content_type_is_type (type, "image", "*")); … … 952 952 GtkTextIter iter; 953 953 gtk_text_buffer_get_end_iter (_buffer, &iter); 954 954 gtk_text_buffer_insert (_buffer, &iter, pch, -1); 955 g_free (pch); 955 // g_free (pch); //SKG don't unref returned const char * 956 956 } 957 957 } 958 958 void 959 BodyPane :: foreach_part_cb (GMimeObject* o, gpointer self)959 BodyPane :: foreach_part_cb (GMimeObject* /*parent*/, GMimeObject* o, gpointer self) 960 960 { 961 961 if (GMIME_IS_MULTIPART (o)) 962 962 g_mime_multipart_foreach (GMIME_MULTIPART (o), foreach_part_cb, self); … … 978 978 const char * key, 979 979 const char * fallback_charset) 980 980 { 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) : ""); 982 982 const std::string utf8_val (header_to_utf8 (val, fallback_charset)); 983 983 char * e (0); 984 984 if (strcmp (key, "From")) … … 1015 1015 const char * key, 1016 1016 const char * fallback_charset) 1017 1017 { 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) : ""); 1019 1019 return add_header_line (s, key_i18n, key, val, fallback_charset); 1020 1020 } 1021 1021 } … … 1037 1037 1038 1038 // conditional headers... 1039 1039 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")); 1041 1041 if (newsgroups.strchr(',')) { 1042 1042 l = add_header_line (s, message, _("Newsgroups"), "Newsgroups", fallback_charset); 1043 1043 w = std::max (w, l); 1044 1044 } 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")); 1046 1046 if (!followup_to.empty() && (followup_to!=newsgroups)) { 1047 1047 l = add_header_line (s, message, _("Followup-To"), "Followup-To", fallback_charset); 1048 1048 w = std::max (w, l); 1049 1049 } 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")); 1051 1051 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")); 1053 1053 StringView f_addr, f_name, rt_addr, rt_name; 1054 1054 GNKSA :: do_check_from (from, f_addr, f_name, false); 1055 1055 GNKSA :: do_check_from (reply_to, rt_addr, rt_name, false); … … 1070 1070 1071 1071 // set the x-face... 1072 1072 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; 1074 1074 if (pch && _xface->window) 1075 1075 pixbuf = pan_gdk_pixbuf_create_from_x_face (gtk_widget_get_colormap(_xface), _xface->window, pch); 1076 1076 gtk_image_set_from_pixbuf (GTK_IMAGE(_xface), pixbuf); … … 1101 1101 // maybe add the headers 1102 1102 const bool do_show_headers (_prefs.get_flag ("show-all-headers", false)); 1103 1103 if (message && do_show_headers) { 1104 char * headers (g_mime_ message_get_headers (message));1104 char * headers (g_mime_object_get_headers ((GMimeObject *) message)); 1105 1105 GtkTextIter end; 1106 1106 gtk_text_buffer_get_end_iter (_buffer, &end); 1107 1107 StringView line, v(headers); … … 1119 1119 1120 1120 // set the text buffer... 1121 1121 if (message) 1122 g_mime_message_foreach _part(message, foreach_part_cb, this);1122 g_mime_message_foreach (message, foreach_part_cb, this); 1123 1123 1124 1124 // if there was a picture, scroll to it. 1125 1125 // otherwise scroll to the top of the body. … … 1514 1514 const char * fallback_charset_1, 1515 1515 const char * fallback_charset_2) 1516 1516 { 1517 const StringView v (g_mime_ message_get_header (msg, key));1517 const StringView v (g_mime_object_get_header ((GMimeObject *) msg, key)); 1518 1518 std::string s; 1519 1519 if (!v.empty()) 1520 1520 s = header_to_utf8 (v, fallback_charset_1, fallback_charset_2); … … 1527 1527 std::string body; 1528 1528 }; 1529 1529 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) 1531 1531 { 1532 1532 if (GMIME_IS_MULTIPART(o)) 1533 1533 { … … 1538 1538 else 1539 1539 { 1540 1540 GMimePart * part = GMIME_PART (o); 1541 constGMimeContentType * type = g_mime_object_get_content_type (o);1541 GMimeContentType * type = g_mime_object_get_content_type (o); 1542 1542 const bool is_text (g_mime_content_type_is_type (type, "text", "*")); 1543 1543 if (is_text) 1544 1544 { … … 1555 1555 if (fallback_charset) 1556 1556 tmp.fallback_charset = fallback_charset; 1557 1557 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); 1559 1559 return tmp.body; 1560 1560 } 1561 1561 } … … 1571 1571 1572 1572 // fallback character encodings 1573 1573 const char * group_charset (_charset.c_str()); 1574 constGMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message)));1574 GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message))); 1575 1575 const char * message_charset (type ? g_mime_content_type_get_parameter (type, "charset") : 0); 1576 1576 1577 1577 /// … … 1585 1585 const std::string reply_to (get_header (_message, "Reply-To", message_charset, group_charset)); 1586 1586 if (is_reply || fup_to=="poster") { 1587 1587 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()); 1589 1589 } else { 1590 1590 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()); 1592 1592 } 1593 1593 1594 1594 // Subject: 1595 StringView v = g_mime_ message_get_header (_message, "Subject");1595 StringView v = g_mime_object_get_header ((GMimeObject *) _message, "Subject"); 1596 1596 std::string h = header_to_utf8 (v, message_charset, group_charset); 1597 1597 std::string val (normalize_subject_re (h)); 1598 1598 if (val.find ("Re:") != 0) // add "Re: " if we don't have one … … 1601 1601 1602 1602 // attribution lines 1603 1603 1604 const char * cpch = g_mime_ message_get_header (_message, "From");1604 const char * cpch = g_mime_object_get_header ((GMimeObject *) _message, "From"); 1605 1605 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()); 1607 1607 1608 1608 cpch = g_mime_message_get_message_id (_message); 1609 1609 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()); 1611 1611 1612 char * tmp = g_mime_message_get_date_ string (_message);1612 char * tmp = g_mime_message_get_date_as_string (_message); 1613 1613 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()); 1615 1615 g_free (tmp); 1616 1616 1617 1617 // references 1618 1618 const char * header = "References"; 1619 v = g_mime_ message_get_header (_message, header);1619 v = g_mime_object_get_header ((GMimeObject *) _message, header); 1620 1620 val.assign (v.str, v.len); 1621 1621 if (!val.empty()) 1622 1622 val += ' '; … … 1624 1624 val += g_mime_message_get_message_id (_message); 1625 1625 val += ">"; 1626 1626 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()); 1628 1628 1629 1629 /// 1630 1630 /// BODY … … 1660 1660 // set the clone's content object with our modified body 1661 1661 GMimeStream * stream = g_mime_stream_mem_new (); 1662 1662 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); 1664 1664 GMimePart * part = g_mime_part_new (); 1665 1665 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); 1667 1667 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); 1669 1669 g_mime_message_set_mime_part (msg, GMIME_OBJECT(part)); 1670 1670 g_object_unref (wrapper); 1671 1671 g_object_unref (part); 1672 1672 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; 1674 1674 } 1675 1675 1676 1676 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 86 86 void append_part (GMimeObject*, GtkAllocation*); 87 87 static gboolean expander_activated_idle (gpointer self); 88 88 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); 90 90 static void text_size_allocated (GtkWidget*, GtkAllocation*, gpointer); 91 91 static gboolean text_size_allocated_idle_cb (gpointer p); 92 92 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 31 31 #include <pan/general/file-util.h> 32 32 #include <pan/general/macros.h> 33 33 #include <pan/usenet-utils/scorefile.h> 34 #include <pan/usenet-utils/mime-utils.h> 34 35 #include <pan/tasks/task-article.h> 35 36 #include <pan/tasks/task-groups.h> 36 37 #include <pan/tasks/task-xover.h> … … 567 568 ArticleCache& c, const Article& a, const std::string& path): 568 569 _data(d), _queue(q), _root(r), _prefs(p), _cache(c), _article(a), _path(path) {} 569 570 570 static void foreach_part_cb (GMimeObject * o, gpointer self)571 static void foreach_part_cb (GMimeObject * /*parent*/, GMimeObject *o, gpointer self) 571 572 { 572 573 static_cast<SaveArticlesFromNZB*>(self)->foreach_part (o); 573 574 } … … 591 592 if (!tasks.empty()) 592 593 _queue.add_tasks (tasks, Queue::BOTTOM); 593 594 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 595 596 } 596 597 } 597 598 … … 601 602 { 602 603 if (status == OK) { 603 604 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); 605 606 g_object_unref (message); 606 607 } 607 608 delete this; … … 1041 1042 const char * cpch; 1042 1043 char * old_mid (g_strdup_printf ("<%s>", g_mime_message_get_message_id(message))); 1043 1044 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); 1045 1046 g_mime_message_set_sender (new_message, g_mime_message_get_sender (message)); 1046 1047 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")); 1049 1050 if ((cpch = g_mime_message_get_reply_to (message))) 1050 1051 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); 1053 1054 gboolean unused (false); 1054 char * body (g_mime_message_get_body (message, true,&unused));1055 char * body (g_mime_message_get_body (message, &unused)); 1055 1056 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); 1057 1058 GMimePart * part = g_mime_part_new (); 1058 1059 g_mime_part_set_content_object (part, content_object); 1059 1060 g_mime_message_set_mime_part (new_message, GMIME_OBJECT(part)); … … 1111 1112 char * cancel_message = g_strdup_printf ("cancel <%s>", g_mime_message_get_message_id(message)); 1112 1113 g_mime_message_set_sender (cancel, g_mime_message_get_sender (message)); 1113 1114 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); 1116 1117 const char * body ("Ignore\r\nArticle canceled by author using " PACKAGE_STRING "\r\n"); 1117 1118 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); 1119 1120 GMimePart * part = g_mime_part_new (); 1120 1121 g_mime_part_set_content_object (part, content_object); 1121 1122 g_mime_message_set_mime_part (cancel, GMIME_OBJECT(part)); … … 1194 1195 newsgroups = group; 1195 1196 } 1196 1197 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()); 1198 1199 1199 1200 // content type 1200 1201 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); 1203 1204 g_mime_message_set_mime_part (message, GMIME_OBJECT(part)); 1204 1205 g_object_unref (part); 1205 1206 … … 1754 1755 g_snprintf (str, sizeof(str), "%s: %u/%u", _("Tasks"), running, size); 1755 1756 1756 1757 // 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. 1759 1760 double KiBps; 1760 1761 int hr, min, sec; 1761 1762 _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 211 211 textdomain (GETTEXT_PACKAGE); 212 212 213 213 g_thread_init (0); 214 g_mime_init (GMIME_ INIT_FLAG_UTF8);214 g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); 215 215 216 216 bool gui(true), nzb(false); 217 217 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 529 529 { 530 530 std::string url, to, groups; 531 531 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)); 534 534 StringView key, val, v(headers); 535 535 v.trim (); 536 536 while (v.pop_token (val, '\n') && val.pop_token(key,':')) { … … 629 629 *** If this is email only, skip the rest of the posting... 630 630 *** we only stayed this long to get check_message() 631 631 **/ 632 const StringView groups (g_mime_ message_get_header (message, "Newsgroups"));632 const StringView groups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups")); 633 633 if (groups.empty()) { 634 634 maybe_mail_message (message); 635 635 return true; … … 903 903 */ 904 904 void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid) 905 905 { 906 g_mime_ message_add_header (msg, "Message-ID", mid);906 g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid); 907 907 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); 909 909 g_free (bracketed); 910 910 } 911 911 } … … 928 928 // headers from the ui: To 929 929 const StringView to (gtk_entry_get_text (GTK_ENTRY(_to_entry))); 930 930 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); 932 932 933 933 // headers from the ui: Newsgroups 934 934 const StringView groups (gtk_entry_get_text (GTK_ENTRY(_groups_entry))); 935 935 if (!groups.empty()) 936 g_mime_ message_set_header (msg, "Newsgroups", groups.str);936 g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", groups.str); 937 937 938 938 // headers from the ui: Followup-To 939 939 const StringView followupto (gtk_entry_get_text (GTK_ENTRY(_followupto_entry))); 940 940 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); 942 942 943 943 // headers from the ui: Reply-To 944 944 const StringView replyto (gtk_entry_get_text (GTK_ENTRY(_replyto_entry))); 945 945 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); 947 947 948 948 // add the 'hidden headers' 949 949 foreach_const (str2str_t, _hidden_headers, it) 950 950 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()); 952 952 953 953 // build headers from the 'more headers' entry field 954 954 std::map<std::string,std::string> headers; … … 964 964 val.trim (); 965 965 std::string key_str (key.to_string()); 966 966 if (extra_header_is_editable (key, val)) 967 g_mime_ message_set_header (msg, key.to_string().c_str(),968 967 g_mime_object_set_header ((GMimeObject *) msg, key.to_string().c_str(), 968 val.to_string().c_str()); 969 969 } 970 970 g_free (pch); 971 971 972 972 // User-Agent 973 973 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()); 975 975 976 976 // Message-ID 977 977 if (mode==POSTING && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) { … … 987 987 const std::string charset ((mode==POSTING && !_charset.empty()) ? _charset : "UTF-8"); 988 988 if (charset != "UTF-8") { 989 989 // 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); 991 991 g_object_unref (stream); 992 992 GMimeFilter * filter = g_mime_filter_charset_new ("UTF-8", charset.c_str()); 993 993 g_mime_stream_filter_add (GMIME_STREAM_FILTER(tmp), filter); 994 994 g_object_unref (filter); 995 995 stream = tmp; 996 996 } 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); 998 998 g_object_unref (stream); 999 999 GMimePart * part = g_mime_part_new (); 1000 1000 pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str()); 1001 1001 GMimeContentType * type = g_mime_content_type_new_from_string (pch); 1002 1002 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. 1004 1004 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); 1006 1006 g_object_unref (content_object); 1007 1007 g_mime_message_set_mime_part (msg, GMIME_OBJECT(part)); 1008 1008 g_object_unref (part); … … 1036 1036 1037 1037 errno = 0; 1038 1038 std::ofstream o (filename); 1039 char * pch = g_mime_ message_to_string (msg);1039 char * pch = g_mime_object_to_string ((GMimeObject *) msg); 1040 1040 o << pch; 1041 1041 o.close (); 1042 1042 … … 1504 1504 std::string s = utf8ize (g_mime_message_get_subject (message)); 1505 1505 gtk_entry_set_text (GTK_ENTRY(_subject_entry), s.c_str()); 1506 1506 1507 s = utf8ize (g_mime_ message_get_header (message, "Newsgroups"));1507 s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups")); 1508 1508 gtk_entry_set_text (GTK_ENTRY(_groups_entry), s.c_str()); 1509 1509 1510 s = utf8ize (g_mime_ message_get_header (message, "Followup-To"));1510 s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Followup-To")); 1511 1511 gtk_entry_set_text (GTK_ENTRY(_followupto_entry), s.c_str()); 1512 1512 1513 s = utf8ize (g_mime_ message_get_header (message, "Reply-To"));1513 s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Reply-To")); 1514 1514 gtk_entry_set_text (GTK_ENTRY(_replyto_entry), s.c_str()); 1515 1515 1516 constInternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);1516 InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO); 1517 1517 char * pch = internet_address_list_to_string (addresses, true); 1518 1518 s = utf8ize (pch); 1519 1519 gtk_entry_set_text (GTK_ENTRY(_to_entry), s.c_str()); … … 1521 1521 1522 1522 // update 'other headers' 1523 1523 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 1527 1545 s = utf8ize (data.visible_headers); 1528 1546 gtk_text_buffer_set_text (_headers_buf, s.c_str(), -1); 1529 1547 _hidden_headers = data.hidden_headers; 1530 1548 1531 1549 // update body 1532 1550 int ignored; 1533 char * tmp = g_mime_message_get_body (message, true,&ignored);1551 char * tmp = g_mime_message_get_body (message, &ignored); 1534 1552 s = utf8ize (tmp); 1535 1553 g_free (tmp); 1536 1554 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 20 20 #include <config.h> 21 21 #include <cassert> 22 22 #include <cstdarg> 23 #include <cstdio> 23 24 #include <cstdlib> // abort, atoi, strtoul 24 25 extern "C" { 25 26 #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 18 18 */ 19 19 20 20 #include <config.h> 21 #include <cstdio> 21 22 #include <ctime> 22 23 #include <glib/gi18n.h> 23 24 #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 30 30 #include "gnksa.h" 31 31 #include "message-check.h" 32 32 #include "text-massager.h" 33 #include "mime-utils.h" 33 34 34 35 using namespace pan; 35 36 … … 62 63 std::string body (body_in.to_string()); 63 64 64 65 // 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); 66 67 if (attribution && *attribution) 67 68 { 68 69 std::string::size_type attrib_start_pos = body.find (attribution); … … 99 100 GMimeMessage * message) 100 101 { 101 102 // 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) 103 104 return; 104 105 105 106 bool quoted_found (false); … … 414 415 } 415 416 } 416 417 417 418 418 void 419 419 MessageCheck :: message_check (const GMimeMessage * message_const, 420 420 const StringView & attribution, … … 432 432 check_subject (errors, goodness, g_mime_message_get_subject (message)); 433 433 434 434 // 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)) { 436 436 errors.insert (_("Error: Bad email address.")); 437 437 goodness.raise_to_warn (); 438 438 } … … 440 440 // check the body... 441 441 TextMassager tm; 442 442 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); 444 444 if (is_html) { 445 445 errors.insert (_("Warning: Most newsgroups frown upon HTML posts.")); 446 446 goodness.raise_to_warn (); 447 447 } 448 448 check_body (errors, goodness, tm, message, body, attribution); 449 449 g_free (body); 450 450 451 451 // check the optional followup-to... 452 452 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"); 454 454 if (cpch && *cpch) { 455 455 quarks_t groups; 456 456 get_nntp_rcpts (cpch, groups); … … 460 460 461 461 // check the groups... 462 462 size_t group_qty (0); 463 cpch = g_mime_ message_get_header (message, "Newsgroups");463 cpch = g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"); 464 464 if (cpch && *cpch) { 465 465 quarks_t groups; 466 466 get_nntp_rcpts (cpch, groups); … … 469 469 } 470 470 471 471 // one last error check 472 constInternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO));472 InternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO)); 473 473 const int n_to (internet_address_list_length (list)); 474 474 if (!group_qty && !n_to) { 475 475 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 22 22 std::cerr << LINE_ID << " [" << i << "][" << *it << ']' << std::endl; \ 23 23 } 24 24 25 static void 26 mime_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 25 39 int main (void) 26 40 { 27 41 g_mime_init (0); … … 41 55 std::string message_id = GNKSA :: generate_message_id ("rebelbase.com"); 42 56 g_mime_message_set_message_id (msg, message_id.c_str()); 43 57 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"); 46 60 GMimePart * part = g_mime_part_new_with_type ("text", "plain"); 47 61 const char * cpch = "Hello World!"; 48 g_mime_part_set_content (part, cpch, strlen(cpch));62 mime_part_set_content (part, cpch); 49 63 g_mime_message_set_mime_part (msg, GMIME_OBJECT(part)); 50 64 // this should pass the tests 51 65 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); … … 54 68 55 69 // all quoted 56 70 cpch = "> Hello World!\n> All quoted text."; 57 g_mime_part_set_content (part, cpch, strlen(cpch));71 mime_part_set_content (part, cpch); 58 72 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 59 73 std::vector<std::string> e (errors.begin(), errors.end()); 60 74 check (errors.size() == 2) … … 64 78 65 79 // mostly quoted 66 80 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); 68 82 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 69 83 e.assign (errors.begin(), errors.end()); 70 84 check (errors.size() == 1) … … 73 87 74 88 // mostly quoted border condition: 20% of message is new content (should pass) 75 89 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); 77 91 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 78 92 check (errors.empty()) 79 93 check (goodness.is_ok()) 80 94 81 95 // sig check: too long 82 96 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); 84 98 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 85 99 e.assign (errors.begin(), errors.end()); 86 100 check (errors.size() == 1) … … 95 109 "This sig line is greater than 80 characters wide. In fact, it's 84 characters wide.\n" 96 110 "This sig line is greater than 80 characters wide. In fact, it measures 95 characters in width!\n" 97 111 "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); 99 113 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 100 114 e.assign (errors.begin(), errors.end()); 101 115 check (errors.size() == 1) … … 104 118 105 119 // sig check: sig marker, no sig 106 120 cpch = "Hello!\n\n-- \n"; 107 g_mime_part_set_content (part, cpch, strlen(cpch));121 mime_part_set_content (part, cpch); 108 122 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 109 123 e.assign (errors.begin(), errors.end()); 110 124 check (errors.size() == 1) … … 113 127 114 128 // sig check: okay sig 115 129 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); 117 131 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 118 132 check (errors.empty()) 119 133 check (goodness.is_ok()) … … 146 160 "This sig line is greater than 80 characters wide. In fact, it's 84 characters wide.\n" 147 161 "This sig line is greater than 80 characters wide. In fact, it measures 95 characters in width!\n" 148 162 "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); 150 164 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 151 165 e.assign (errors.begin(), errors.end()); 152 166 check (errors.size() == 1) … … 155 169 156 170 // body empty 157 171 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); 159 173 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 160 174 e.assign (errors.begin(), errors.end()); 161 175 check (errors.size() == 2) … … 163 177 check (e[0] == "Error: Message appears to have no new content."); 164 178 check (e[1] == "Error: Message is empty."); 165 179 cpch = "Some valid message."; 166 g_mime_part_set_content (part, cpch, strlen(cpch));180 mime_part_set_content (part, cpch); 167 181 168 182 // empty subject 169 183 g_mime_message_set_subject (msg, ""); … … 175 189 g_mime_message_set_subject (msg, "Happy Lucky Feeling"); 176 190 177 191 // 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"); 179 193 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 180 194 e.assign (errors.begin(), errors.end()); 181 195 check (errors.size() == 1) 182 196 check (goodness.is_warn()) 183 197 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"); 185 199 186 200 // 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"); 189 203 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 190 204 e.assign (errors.begin(), errors.end()); 191 205 check (errors.size() == 1) … … 193 207 check (e[0] == "Warning: Crossposting without setting Followup-To header.") 194 208 195 209 // 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"); 198 212 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 199 213 e.assign (errors.begin(), errors.end()); 200 214 check (errors.size() == 1) … … 203 217 g_mime_object_remove_header (GMIME_OBJECT(msg), "Followup-To"); 204 218 205 219 // 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>>"); 207 221 cpch = "How Fascinating!\n" 208 222 "\n" 209 223 "> Blah blah blah.\n"; 210 g_mime_part_set_content (part, cpch, strlen(cpch));224 mime_part_set_content (part, cpch); 211 225 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 212 226 e.assign (errors.begin(), errors.end()); 213 227 check (errors.size() == 1) … … 216 230 g_mime_object_remove_header (GMIME_OBJECT(msg), "References"); 217 231 218 232 // 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>>"); 220 234 cpch = "How Fascinating!\n" 221 235 "\n" 222 236 "> Blah blah blah.\n" … … 224 238 "-- \n" 225 239 "Pan shouldn't mistake this signature for\n" 226 240 "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); 228 242 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 229 243 e.assign (errors.begin(), errors.end()); 230 244 check (errors.size() == 1) … … 238 252 "\n" 239 253 "--\n" 240 254 "This is my signature.\n"; 241 g_mime_part_set_content (part, cpch, strlen(cpch));255 mime_part_set_content (part, cpch); 242 256 MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness); 243 257 e.assign (errors.begin(), errors.end()); 244 258 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 455 455 part->stream = g_mime_stream_mem_new (); 456 456 if (part->type != ENC_PLAIN) { 457 457 part->filter_stream = 458 g_mime_stream_filter_new _with_stream(part->stream);458 g_mime_stream_filter_new (part->stream); 459 459 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); 462 462 g_mime_stream_filter_add (GMIME_STREAM_FILTER(part->filter_stream), 463 463 part->filter); 464 464 } … … 722 722 { 723 723 // if the part is a multipart, check its subparts 724 724 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); 728 731 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); 731 734 } 732 735 return; 733 736 } 734 737 735 738 // we assume that inlined yenc and uu are only in text/plain blocks 736 constGMimeContentType * content_type = g_mime_object_get_content_type (*part);739 GMimeContentType * content_type = g_mime_object_get_content_type (*part); 737 740 if (!g_mime_content_type_is_type (content_type, "text", "plain")) 738 741 return; 739 742 … … 746 749 GMimeStream * stream = g_mime_data_wrapper_get_stream (content); 747 750 g_mime_stream_reset (stream); 748 751 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 751 754 752 755 // break it into separate parts for text, uu, and yenc pieces. 753 756 temp_parts_t parts; … … 774 777 g_mime_part_set_filename (subpart, filename); 775 778 776 779 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); 778 781 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)); 780 783 781 784 g_object_unref (content); 782 785 g_object_unref (subpart); 783 786 } 784 787 785 788 // replace the old part with the new multipart 786 g_ mime_object_unref (*part);789 g_object_unref (*part); 787 790 *part = GMIME_OBJECT (multipart); 788 791 } 789 792 790 793 foreach (temp_parts_t, parts, it) 791 794 delete *it; 792 g_ mime_stream_unref (istream);795 g_object_unref (istream); 793 796 } 794 797 } 795 798 … … 831 834 GMimeStream * stream = g_mime_data_wrapper_get_stream (wrapper); 832 835 g_mime_stream_reset (stream); 833 836 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 836 839 } 837 840 838 841 GMimeMessage * message = messages[0]; 839 842 GMimeDataWrapper * wrapper = g_mime_part_get_content_object (GMIME_PART(message->mime_part)); 840 843 g_mime_stream_reset (cat); 841 844 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 843 846 g_object_unref (cat); 844 847 } 845 848 … … 1007 1010 { 1008 1011 normalize_subject (subject, STRIP_MULTIPART_NUMERATOR, setme); 1009 1012 } 1013 1014 static GMimeObject * 1015 handle_multipart_mixed (GMimeMultipart *multipart, gboolean *is_html); 1016 1017 static GMimeObject * 1018 handle_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 1039 static GMimeObject * 1040 handle_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 1086 static const char * 1087 g_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 1136 char *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 1173 void 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 64 64 }; 65 65 } 66 66 67 char *g_mime_message_get_body (GMimeMessage *message, gboolean *is_html); 68 void g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string); 69 70 67 71 #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 19 19 20 20 #include <config.h> 21 21 #include <cctype> 22 #include <cstdio> 22 23 #include <pan/general/string-view.h> 23 24 #include "numbers.h" 24 25 #include <algorithm> -
pan.spec
diff -Naur pan-0.133.orig/pan.spec pan-0.133/pan.spec
old new 15 15 16 16 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot 17 17 BuildRequires: glib2-devel >= 2.4.0 18 BuildRequires: gmime-devel >= 2. 1.918 BuildRequires: gmime-devel >= 2.3.5 19 19 BuildRequires: gtk2-devel >= 2.4.0 20 20 BuildRequires: pcre-devel >= 5.0 21 21 %{!?_without_gtkspell:BuildRequires: gtkspell-devel >= 2.0.7} 22 22 23 23 Requires: pcre >= 5.0 24 24 Requires: glib2 >= 2.4.0 25 Requires: gmime >= 2. 1.925 Requires: gmime >= 2.3.5 26 26 Requires: gtk2 >= 2.4.0 27 27 %{!?_without_gtkspell:Requires: gtkspell >= 2.0.7} 28 28