@@ -837,7 +837,6 @@ namespace
837837 }
838838
839839 g_object_unref (mem_stream);
840- g_object_unref (wrapper);
841840 }
842841
843842 // flush the loader
@@ -874,7 +873,7 @@ BodyPane :: append_part (GMimeObject * obj, GtkAllocation * widget_size)
874873 return ;
875874
876875 GMimePart * part = GMIME_PART (obj);
877- const GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
876+ GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
878877
879878 // decide whether or not this part is a picture
880879 bool is_image (g_mime_content_type_is_type (type, " image" , " *" ));
@@ -956,15 +955,11 @@ BodyPane :: append_part (GMimeObject * obj, GtkAllocation * widget_size)
956955 }
957956}
958957void
959- BodyPane :: foreach_part_cb (GMimeObject* o, gpointer self)
958+ BodyPane :: foreach_part_cb (GMimeObject* /* parent */ , GMimeObject* o, gpointer self)
960959{
961- if (GMIME_IS_MULTIPART (o))
962- g_mime_multipart_foreach (GMIME_MULTIPART (o), foreach_part_cb, self);
963- else {
964- BodyPane * pane = static_cast <BodyPane*>(self);
965- GtkWidget * w (pane->_text );
966- pane->append_part (o, &w->allocation );
967- }
960+ BodyPane * pane = static_cast <BodyPane*>(self);
961+ GtkWidget * w (pane->_text );
962+ pane->append_part (o, &w->allocation );
968963}
969964
970965
@@ -978,7 +973,7 @@ namespace
978973 const char * key,
979974 const char * fallback_charset)
980975 {
981- const char * val (message ? g_mime_message_get_header ( message, key) : " " );
976+ const char * val (message ? g_mime_object_get_header ((GMimeObject *) message, key) : " " );
982977 const std::string utf8_val (header_to_utf8 (val, fallback_charset));
983978 char * e (0 );
984979 if (strcmp (key, " From" ))
@@ -1015,7 +1010,7 @@ namespace
10151010 const char * key,
10161011 const char * fallback_charset)
10171012 {
1018- const char * val (msg ? g_mime_message_get_header ( msg, key) : " " );
1013+ const char * val (msg ? g_mime_object_get_header ((GMimeObject *) msg, key) : " " );
10191014 return add_header_line (s, key_i18n, key, val, fallback_charset);
10201015 }
10211016}
@@ -1037,19 +1032,19 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
10371032
10381033 // conditional headers...
10391034 if (message) {
1040- const StringView newsgroups (g_mime_message_get_header ( message, " Newsgroups" ));
1035+ const StringView newsgroups (g_mime_object_get_header ((GMimeObject *) message, " Newsgroups" ));
10411036 if (newsgroups.strchr (' ,' )) {
10421037 l = add_header_line (s, message, _ (" Newsgroups" ), " Newsgroups" , fallback_charset);
10431038 w = std::max (w, l);
10441039 }
1045- const StringView followup_to (g_mime_message_get_header ( message, " Followup-To" ));
1040+ const StringView followup_to (g_mime_object_get_header ((GMimeObject *) message, " Followup-To" ));
10461041 if (!followup_to.empty () && (followup_to!=newsgroups)) {
10471042 l = add_header_line (s, message, _ (" Followup-To" ), " Followup-To" , fallback_charset);
10481043 w = std::max (w, l);
10491044 }
1050- const StringView reply_to (g_mime_message_get_header ( message, " Reply-To" ));
1045+ const StringView reply_to (g_mime_object_get_header ((GMimeObject *) message, " Reply-To" ));
10511046 if (!reply_to.empty ()) {
1052- const StringView from (g_mime_message_get_header ( message, " From" ));
1047+ const StringView from (g_mime_object_get_header ((GMimeObject *) message, " From" ));
10531048 StringView f_addr, f_name, rt_addr, rt_name;
10541049 GNKSA :: do_check_from (from, f_addr, f_name, false );
10551050 GNKSA :: do_check_from (reply_to, rt_addr, rt_name, false );
@@ -1068,7 +1063,7 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
10681063
10691064 // set the x-face...
10701065 GdkPixbuf * pixbuf (0 );
1071- const char * pch = message ? g_mime_message_get_header ( message, " X-Face" ) : 0 ;
1066+ const char * pch = message ? g_mime_object_get_header ((GMimeObject *) message, " X-Face" ) : 0 ;
10721067 if (pch && _xface->window )
10731068 pixbuf = pan_gdk_pixbuf_create_from_x_face (gtk_widget_get_colormap (_xface), _xface->window , pch);
10741069 gtk_image_set_from_pixbuf (GTK_IMAGE (_xface), pixbuf);
@@ -1097,7 +1092,7 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
10971092 // maybe add the headers
10981093 const bool do_show_headers (_prefs.get_flag (" show-all-headers" , false ));
10991094 if (message && do_show_headers) {
1100- char * headers (g_mime_message_get_headers ( message));
1095+ char * headers (g_mime_object_get_headers ((GMimeObject *) message));
11011096 GtkTextIter end;
11021097 gtk_text_buffer_get_end_iter (_buffer, &end);
11031098 StringView line, v (headers);
@@ -1115,7 +1110,7 @@ BodyPane :: set_text_from_message (GMimeMessage * message)
11151110
11161111 // set the text buffer...
11171112 if (message)
1118- g_mime_message_foreach_part (message, foreach_part_cb, this );
1113+ g_mime_message_foreach (message, foreach_part_cb, this );
11191114
11201115 // if there was a picture, scroll to it.
11211116 // otherwise scroll to the top of the body.
@@ -1504,7 +1499,7 @@ namespace
15041499 const char * fallback_charset_1,
15051500 const char * fallback_charset_2)
15061501 {
1507- const StringView v (g_mime_message_get_header ( msg, key));
1502+ const StringView v (g_mime_object_get_header ((GMimeObject *) msg, key));
15081503 std::string s;
15091504 if (!v.empty ())
15101505 s = header_to_utf8 (v, fallback_charset_1, fallback_charset_2);
@@ -1517,24 +1512,17 @@ namespace
15171512 std::string body;
15181513 };
15191514
1520- void get_utf8_body_foreach_part (GMimeObject *o, gpointer user_data)
1515+ void get_utf8_body_foreach_part (GMimeObject* /* parent*/ , GMimeObject *o,
1516+ gpointer user_data)
15211517 {
1522- if (GMIME_IS_MULTIPART (o))
1518+ GMimePart * part;
1519+ GMimeContentType * type = g_mime_object_get_content_type (o);
1520+ const bool is_text (g_mime_content_type_is_type (type, " text" , " *" ));
1521+ if (is_text)
15231522 {
1524- g_mime_multipart_foreach (GMIME_MULTIPART (o),
1525- get_utf8_body_foreach_part,
1526- user_data);
1527- }
1528- else
1529- {
1530- GMimePart * part = GMIME_PART (o);
1531- const GMimeContentType * type = g_mime_object_get_content_type (o);
1532- const bool is_text (g_mime_content_type_is_type (type, " text" , " *" ));
1533- if (is_text)
1534- {
1535- ForeachPartData *data (static_cast <ForeachPartData*>(user_data));
1536- data->body += mime_part_to_utf8 (part, data->fallback_charset .c_str ());
1537- }
1523+ part = GMIME_PART (o);
1524+ ForeachPartData *data (static_cast <ForeachPartData*>(user_data));
1525+ data->body += mime_part_to_utf8 (part, data->fallback_charset .c_str ());
15381526 }
15391527 }
15401528
@@ -1545,7 +1533,7 @@ namespace
15451533 if (fallback_charset)
15461534 tmp.fallback_charset = fallback_charset;
15471535 if (source)
1548- g_mime_message_foreach_part (source, get_utf8_body_foreach_part, &tmp);
1536+ g_mime_message_foreach (source, get_utf8_body_foreach_part, &tmp);
15491537 return tmp.body ;
15501538 }
15511539}
@@ -1558,10 +1546,12 @@ BodyPane :: create_followup_or_reply (bool is_reply)
15581546 if (_message)
15591547 {
15601548 msg = g_mime_message_new (false );
1549+ GMimeObject msg_obj = (GMimeObject*)msg
1550+ GMimeObject _message_obj = (GMimeObject*)_message
15611551
15621552 // fallback character encodings
15631553 const char * group_charset (_charset.c_str ());
1564- const GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT (_message)));
1554+ GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT (_message)));
15651555 const char * message_charset (type ? g_mime_content_type_get_parameter (type, " charset" ) : 0 );
15661556
15671557 // /
@@ -1575,14 +1565,14 @@ BodyPane :: create_followup_or_reply (bool is_reply)
15751565 const std::string reply_to (get_header (_message, " Reply-To" , message_charset, group_charset));
15761566 if (is_reply || fup_to==" poster" ) {
15771567 const std::string& to (reply_to.empty () ? from : reply_to);
1578- g_mime_message_add_recipients_from_string (msg, ( char *) GMIME_RECIPIENT_TYPE_TO, to.c_str ());
1568+ pan_g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.c_str ());
15791569 } else {
15801570 const std::string& groups (fup_to.empty () ? newsgroups : fup_to);
1581- g_mime_message_add_header ( msg, " Newsgroups" , groups.c_str ());
1571+ g_mime_object_append_header ((GMimeObject *) msg, " Newsgroups" , groups.c_str ());
15821572 }
15831573
15841574 // Subject:
1585- StringView v = g_mime_message_get_header (_message , " Subject" );
1575+ StringView v = g_mime_object_get_header (_message_obj , " Subject" );
15861576 std::string h = header_to_utf8 (v, message_charset, group_charset);
15871577 std::string val (normalize_subject_re (h));
15881578 if (val.find (" Re:" ) != 0 ) // add "Re: " if we don't have one
@@ -1591,30 +1581,30 @@ BodyPane :: create_followup_or_reply (bool is_reply)
15911581
15921582 // attribution lines
15931583
1594- const char * cpch = g_mime_message_get_header (_message , " From" );
1584+ const char * cpch = g_mime_object_get_header (_message_obj , " From" );
15951585 h = header_to_utf8 (cpch, message_charset, group_charset);
1596- g_mime_message_add_header (msg , " X-Draft-Attribution-Author" , h.c_str ());
1586+ g_mime_object_append_header (msg_obj , " X-Draft-Attribution-Author" , h.c_str ());
15971587
15981588 cpch = g_mime_message_get_message_id (_message);
15991589 h = header_to_utf8 (cpch, message_charset, group_charset);
1600- g_mime_message_add_header (msg , " X-Draft-Attribution-Id" , h.c_str ());
1590+ g_mime_object_append_header (msg_obj , " X-Draft-Attribution-Id" , h.c_str ());
16011591
1602- char * tmp = g_mime_message_get_date_string (_message);
1592+ char * tmp = g_mime_message_get_date_as_string (_message);
16031593 h = header_to_utf8 (tmp, message_charset, group_charset);
1604- g_mime_message_add_header (msg , " X-Draft-Attribution-Date" , h.c_str ());
1594+ g_mime_object_append_header (msg_obj , " X-Draft-Attribution-Date" , h.c_str ());
16051595 g_free (tmp);
16061596
16071597 // references
16081598 const char * header = " References" ;
1609- v = g_mime_message_get_header (_message , header);
1599+ v = g_mime_object_get_header (_message_obj , header);
16101600 val.assign (v.str , v.len );
16111601 if (!val.empty ())
16121602 val += ' ' ;
16131603 val += " <" ;
16141604 val += g_mime_message_get_message_id (_message);
16151605 val += " >" ;
16161606 val = GNKSA :: trim_references (val);
1617- g_mime_message_add_header (msg , header, val.c_str ());
1607+ g_mime_object_append_header (msg_obj , header, val.c_str ());
16181608
16191609 // /
16201610 // / BODY
@@ -1650,17 +1640,18 @@ BodyPane :: create_followup_or_reply (bool is_reply)
16501640 // set the clone's content object with our modified body
16511641 GMimeStream * stream = g_mime_stream_mem_new ();
16521642 g_mime_stream_write_string (stream, s.c_str ());
1653- GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_8BIT );
1643+ GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_8BIT );
16541644 GMimePart * part = g_mime_part_new ();
16551645 GMimeContentType * new_type = g_mime_content_type_new_from_string (" text/plain; charset=UTF-8" );
1656- g_mime_part_set_content_type ( part, new_type);
1646+ g_mime_object_set_content_type ((GMimeObject *) part, new_type);
16571647 g_mime_part_set_content_object (part, wrapper);
1658- g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT );
1648+ g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT );
16591649 g_mime_message_set_mime_part (msg, GMIME_OBJECT (part));
1650+ g_object_unref (new_type);
16601651 g_object_unref (wrapper);
16611652 g_object_unref (part);
16621653 g_object_unref (stream);
1663- // std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_message_to_string( msg) << ']' << std::endl;
1654+ // std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_object_to_string((GMimeObject *) msg) << ']' << std::endl;
16641655 }
16651656
16661657 return msg;
0 commit comments