[balsa/gmime3: 47/49] GMimeParser changes
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gmime3: 47/49] GMimeParser changes
- Date: Wed, 26 Feb 2020 16:02:03 +0000 (UTC)
commit b8a7fb01a21726d5538be177534ae9b46adf26e6
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 d1c4407d7..102f80114 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 8d67bdbe7..285879013 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 d9c8e2cc7..2aad4dd1f 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 6100ef284..239f4b03e 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -4237,6 +4237,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 10df8fff8..1828db2a8 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 2694c551c..5e28f5381 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -1120,6 +1120,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);
@@ -1822,6 +1823,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 5a16daad2..c7faa3bfd 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 3aad799fa..e115298fd 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]