[geary: 10/23] Create new GMime.Part instances with an explicit MIME-type



commit d98755d04fe3950643f7dda30776c2069bef1b9d
Author: Torben <torben letorbi gmail com>
Date:   Wed Dec 11 23:25:59 2019 +0100

    Create new GMime.Part instances with an explicit MIME-type

 src/engine/rfc822/rfc822-message.vala            | 8 ++++----
 test/engine/imap-db/imap-db-attachment-test.vala | 2 +-
 test/engine/rfc822-part-test.vala                | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala
index 38af4b87..863c6e19 100644
--- a/src/engine/rfc822/rfc822-message.vala
+++ b/src/engine/rfc822/rfc822-message.vala
@@ -430,7 +430,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
             FileQueryInfoFlags.NONE
         );
 
-        GMime.Part part = new GMime.Part();
+        GMime.Part part = new GMime.Part.with_type("text", "plain");
         part.set_disposition(disposition.serialize());
         part.set_filename(file.get_basename());
 
@@ -477,7 +477,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
                 );
         }
 
-        GMime.Part part = new GMime.Part();
+        GMime.Part part = new GMime.Part.with_type("text", "plain");
         part.set_disposition(disposition.serialize());
         part.set_filename(basename);
         part.set_content_type(content_type);
@@ -1056,7 +1056,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
         string filename = (string) filenameProp.data;
         uint8[] data = Bytes.unref_to_data(new Bytes(a.FileData.data));
 
-        GMime.Part part = new GMime.Part();
+        GMime.Part part = new GMime.Part.with_type("text", "plain");
         part.set_filename(filename);
         part.set_content_type(GMime.ContentType.parse(Geary.RFC822.get_parser_options(), 
GLib.ContentType.guess(filename, data, null)));
         part.set_content(new GMime.DataWrapper.with_stream(new GMime.StreamMem.with_buffer(data), 
GMime.ContentEncoding.BINARY));
@@ -1181,7 +1181,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
             filter_stream, GMime.ContentEncoding.DEFAULT
         );
 
-        GMime.Part body_part = new GMime.Part();
+        GMime.Part body_part = new GMime.Part.with_type("text", "plain");
         body_part.set_content_type(complete_type);
         body_part.set_content(body);
         body_part.set_content_encoding(encoding);
diff --git a/test/engine/imap-db/imap-db-attachment-test.vala 
b/test/engine/imap-db/imap-db-attachment-test.vala
index 9366802e..bf201b70 100644
--- a/test/engine/imap-db/imap-db-attachment-test.vala
+++ b/test/engine/imap-db/imap-db-attachment-test.vala
@@ -355,7 +355,7 @@ VALUES (2, 'text/plain');
 private GMime.Part new_part(string? mime_type,
                             uint8[] body,
                             GMime.ContentEncoding encoding = GMime.ContentEncoding.DEFAULT) {
-    GMime.Part part = new GMime.Part();
+    GMime.Part part = new GMime.Part.with_type("text", "plain");
     if (mime_type != null) {
         part.set_content_type(GMime.ContentType.parse(
             Geary.RFC822.get_parser_options(),
diff --git a/test/engine/rfc822-part-test.vala b/test/engine/rfc822-part-test.vala
index 4fbe5d87..9ec2cabf 100644
--- a/test/engine/rfc822-part-test.vala
+++ b/test/engine/rfc822-part-test.vala
@@ -94,7 +94,7 @@ class Geary.RFC822.PartTest : TestCase {
 
     private GMime.Part new_part(string? mime_type,
                                 uint8[] body) {
-        GMime.Part part = new GMime.Part();
+        GMime.Part part = new GMime.Part.with_type("text", "plain");
         if (mime_type != null) {
             part.set_content_type(GMime.ContentType.parse(
                 Geary.RFC822.get_parser_options(),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]