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




commit bafb4ddc3c17b3aa3b3fde98f41bb4d32ef98d98
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 fe65174aa..50bf3a3f1 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1243,6 +1243,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 &&
@@ -1400,7 +1401,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)) {
@@ -1429,7 +1430,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);
@@ -1447,7 +1448,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]