[balsa/gmime3: 48/50] GMimeParser changes



commit f7a3aa85bdf79b2bf2a6de2ecaa672f3abedefa6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Nov 27 14:33:20 2019 -0500

    GMimeParser changes
    
    Explicitly set the parser format; it defaults to GMIME_FORMAT_MESSAGE,
    but that's not documented, so we should always set it.
    
    Also, use the g_mime_parser_new_with_stream() convenience function.
    
    modified:   libbalsa/body.c
    modified:   libbalsa/gmime-application-pkcs7.c
    modified:   libbalsa/gmime-multipart-crypt.c
    modified:   libbalsa/mailbox.c
    modified:   libbalsa/mailbox_imap.c
    modified:   libbalsa/mailbox_mbox.c
    modified:   libbalsa/send.c
    modified:   src/sendmsg-window.c

 libbalsa/body.c                    | 1 +
 libbalsa/gmime-application-pkcs7.c | 4 ++--
 libbalsa/gmime-multipart-crypt.c   | 5 +++--
 libbalsa/mailbox.c                 | 1 +
 libbalsa/mailbox_imap.c            | 2 ++
 libbalsa/mailbox_mbox.c            | 2 ++
 libbalsa/send.c                    | 1 +
 src/sendmsg-window.c               | 4 ++--
 8 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/libbalsa/body.c b/libbalsa/body.c
index 7d4b752e0..4cc0dae20 100644
--- a/libbalsa/body.c
+++ b/libbalsa/body.c
@@ -229,6 +229,7 @@ libbalsa_message_body_set_text_rfc822headers(LibBalsaMessageBody *body)
 
        g_mime_stream_reset(headers);
        parser = g_mime_parser_new_with_stream(headers);
+        g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
        g_object_unref(headers);
        dummy_msg = g_mime_parser_construct_message(parser, libbalsa_parser_options());
        g_object_unref(parser);
diff --git a/libbalsa/gmime-application-pkcs7.c b/libbalsa/gmime-application-pkcs7.c
index 662fc135d..5bc7a343a 100644
--- a/libbalsa/gmime-application-pkcs7.c
+++ b/libbalsa/gmime-application-pkcs7.c
@@ -107,8 +107,8 @@ g_mime_application_pkcs7_decrypt_verify(GMimePart * pkcs7,
     g_object_unref(ciphertext);
 
     g_mime_stream_reset(stream);
-    parser = g_mime_parser_new();
-    g_mime_parser_init_with_stream(parser, stream);
+    parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
     g_object_unref(stream);
 
     decrypted = g_mime_parser_construct_part(parser, libbalsa_parser_options());
diff --git a/libbalsa/gmime-multipart-crypt.c b/libbalsa/gmime-multipart-crypt.c
index 8a57f8ffc..723cad026 100644
--- a/libbalsa/gmime-multipart-crypt.c
+++ b/libbalsa/gmime-multipart-crypt.c
@@ -173,6 +173,7 @@ g_mime_gpgme_mps_sign(GMimeMultipartSigned * mps, GMimeObject * content,
 
     /* construct the content part */
     parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
     content = g_mime_parser_construct_part(parser, libbalsa_parser_options());
     g_object_unref(stream);
     g_object_unref(parser);
@@ -520,8 +521,8 @@ g_mime_gpgme_mpe_decrypt(GMimeMultipartEncrypted * mpe,
     g_object_unref(ciphertext);
 
     g_mime_stream_reset(stream);
-    parser = g_mime_parser_new();
-    g_mime_parser_init_with_stream(parser, stream);
+    parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
     g_object_unref(stream);
 
     decrypted = g_mime_parser_construct_part(parser, libbalsa_parser_options());
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 87e481d7f..3d0b78c5e 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -4189,6 +4189,7 @@ lbm_get_mime_msg(LibBalsaMailbox * mailbox, LibBalsaMessage *message)
                                                      libbalsa_message_get_msgno(message),
                                                     TRUE);
         parser = g_mime_parser_new_with_stream(stream);
+        g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
         g_object_unref(stream);
         mime_msg = g_mime_parser_construct_message(parser, libbalsa_parser_options());
         g_object_unref(parser);
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 24c1857b0..314fa3045 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -2171,6 +2171,7 @@ get_struct_from_cache(LibBalsaMailbox *mailbox, LibBalsaMessage *message,
         g_object_unref(filter);
 
         mime_parser = g_mime_parser_new_with_stream(fstream);
+        g_mime_parser_set_format(mime_parser, GMIME_FORMAT_MESSAGE);
         g_object_unref(fstream);
 
         g_mime_parser_set_format(mime_parser, GMIME_FORMAT_MESSAGE);
@@ -2543,6 +2544,7 @@ lbm_imap_get_msg_part_from_cache(LibBalsaMessage * message,
     {
         GMimeParser *parser =  
             g_mime_parser_new_with_stream (partstream);
+        g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
         part->mime_part = g_mime_parser_construct_part (parser, libbalsa_parser_options());
         g_object_unref (parser);
     }
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index 88380df74..33410264e 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -1121,6 +1121,7 @@ lbm_mbox_get_mime_message(LibBalsaMailbox * mailbox,
        return NULL;
     libbalsa_mime_stream_shared_lock(stream);
     parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
 
     mime_message = g_mime_parser_construct_message(parser, libbalsa_parser_options());
     g_object_unref(parser);
@@ -1823,6 +1824,7 @@ lbm_mbox_armored_object(GMimeStream * stream)
     GMimeObject *object;
 
     parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
     object = GMIME_OBJECT(g_mime_parser_construct_message(parser, libbalsa_parser_options()));
     g_object_unref(parser);
     g_mime_object_encode(object, GMIME_ENCODING_CONSTRAINT_7BIT);
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 601c7048a..9b705fdbd 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1313,6 +1313,7 @@ libbalsa_message_create_mime_message(LibBalsaMessage *message,
                     return LIBBALSA_MESSAGE_CREATE_ERROR;
                 }
                 parser = g_mime_parser_new_with_stream(stream);
+                g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
                 g_object_unref(stream);
                 mime_msg = g_mime_parser_construct_message(parser, libbalsa_parser_options());
                 g_object_unref(parser);
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index e1817ab20..c56a4b34a 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -1630,8 +1630,8 @@ get_fwd_mail_headers(const gchar *mailfile)
     }
 
     /* parse the file */
-    parser = g_mime_parser_new();
-    g_mime_parser_init_with_stream(parser, stream);
+    parser = g_mime_parser_new_with_stream(stream);
+    g_mime_parser_set_format(parser, GMIME_FORMAT_MESSAGE);
     message = g_mime_parser_construct_message (parser, libbalsa_parser_options());
     g_object_unref (parser);
     g_object_unref(stream);


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