[balsa/69-resend-message] send: Avoid signing and encrypting when resending




commit cd1ddbd6980ca16a5ae5bd42833fd6212f8e6a87
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Mar 2 18:27:25 2022 -0500

    send: Avoid signing and encrypting when resending

 libbalsa/send.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 82415d7f2..69d7d4808 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1242,6 +1242,7 @@ create_mime_message(LibBalsaMessage *message,
     LibBalsaIdentity *identity;
 #endif /* ENABLE_AUTOCRYPT */
     GDateTime *datetime;
+    gboolean resending = libbalsa_message_get_user_header(message, "X-Balsa-Resend") != NULL;
 
     /* attach the public key only if we send the message, not if we just postpone it */
     if (!postponing &&
@@ -1399,7 +1400,7 @@ create_mime_message(LibBalsaMessage *message,
             LibBalsaMsgCreateResult crypt_res = LIBBALSA_MESSAGE_CREATE_OK;
 
             /* in '2440 mode, touch *only* the first body! */
-            if (!postponing &&
+            if (!resending && !postponing &&
                 (body == libbalsa_message_get_body_list(body->message)) &&
                 ((gpg_mode = libbalsa_message_get_gpg_mode(message)) > 0) &&
                 ((gpg_mode & LIBBALSA_PROTECT_OPENPGP) != 0)) {
@@ -1428,7 +1429,7 @@ create_mime_message(LibBalsaMessage *message,
         body = body->next;
     }
 
-    if (attach_pubkey) {
+    if (!resending && attach_pubkey) {
        GMimePart *pubkey_part;
 
        pubkey_part = lb_create_pubkey_part(message, parent, error);
@@ -1446,7 +1447,7 @@ create_mime_message(LibBalsaMessage *message,
         }
     }
 
-    if ((libbalsa_message_get_body_list(message) != NULL) && !postponing) {
+    if (!resending && (libbalsa_message_get_body_list(message) != NULL) && !postponing) {
         LibBalsaMsgCreateResult crypt_res =
             do_multipart_crypto(message, &mime_root, parent, error);
         if (crypt_res != LIBBALSA_MESSAGE_CREATE_OK) {


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