[Patch] fix confusing warning sending RFC 4880 encrypted messages



Hi all,

I noticed that when sending a RFC 4880 (old OpenPGP mode) encrypted message, the warning “This message will 
not be encrypted for the BCC: recipients” pops up, even if no Bcc: recipients have been specified.  This is 
apparently caused by a missing check for an empty bcc recipients list.

The attached trivial patch fixes it, and also fixes the singular/plural form of the warning for the (modern) 
multipart/encrypted formats.

Opinions?

Cheers,
Albrecht.

---
Patch details:
- libbalsa/send.c: fix confusing bcc: encryption warning in libbalsa_create_rfc2440_buffer() if no bcc: 
recipients are present; use singular/plural form of this warning in do_multipart_crypto()
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 51908f578..a68f1b079 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1822,7 +1822,8 @@ libbalsa_create_rfc2440_buffer(LibBalsaMessage *message,
                                         message->headers->cc_list);
         encrypt_for = get_mailbox_names(encrypt_for,
                                         message->headers->from);
-        if (message->headers->bcc_list != NULL) {
+        if ((message->headers->bcc_list != NULL) &&
+               (internet_address_list_length(message->headers->bcc_list) > 0)) {
             libbalsa_information
                 (LIBBALSA_INFORMATION_WARNING,
                 ngettext("This message will not be encrypted "
@@ -1918,9 +1919,14 @@ do_multipart_crypto(LibBalsaMessage *message,
         if (message->headers->bcc_list
             && (internet_address_list_length(message->headers->
                                              bcc_list) > 0)) {
-            libbalsa_information(LIBBALSA_INFORMATION_WARNING,
-                                 _(
-                                     "This message will not be encrypted for the BCC: recipient(s)."));
+            libbalsa_information
+                (LIBBALSA_INFORMATION_WARNING,
+                ngettext("This message will not be encrypted "
+                         "for the BCC: recipient.",
+                         "This message will not be encrypted "
+                         "for the BCC: recipients.",
+                         internet_address_list_length
+                             (message->headers->bcc_list)));
         }
 
         if (message->gpg_mode & LIBBALSA_PROTECT_SIGN) {

Attachment: pgpz7VWibkLao.pgp
Description: PGP signature



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