Make PGP decode failure non-fatal when displaying messages (as opposed to
authorBrendan Cully <brendan@kublai.com>
Mon, 10 Oct 2005 18:26:31 +0000 (18:26 +0000)
committerBrendan Cully <brendan@kublai.com>
Mon, 10 Oct 2005 18:26:31 +0000 (18:26 +0000)
decode-saving them). I think it would be nicer to include the original text
when decryption fails though...

pgp.c

diff --git a/pgp.c b/pgp.c
index f8dc677125cdc41dd66a212970d613a52e2c7ea8..7760f2a7e9124105825e63db399a7bfb4dd8b772 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -330,8 +330,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
 
       /* leave tmpfp open in case we still need it - but flush it! */
       fflush (tmpfp);
-      
-      
+
       /* Invoke PGP if needed */
       if (!clearsign || (s->flags & M_VERIFY))
       {
@@ -389,6 +388,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
        }
        
         /* treat empty result as sign of failure */
+       /* TODO: maybe on failure mutt should include the original undecoded text. */
        if (pgpout)
        {
          rewind (pgpout);
@@ -400,9 +400,12 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
           mutt_error _("Could not decrypt PGP message");
          mutt_sleep (1);
           pgp_void_passphrase ();
-          rc = -1;
-          
-          goto out;
+
+         if (!(s->flags & M_DISPLAY))
+         {
+           rc = -1;
+           goto out;
+         }
         }
       }