]> granicus.if.org Git - mutt/commitdiff
Make sure that crypt_reply replies with the same type, despite a
authorRené Clerc <rene@clerc.nl>
Thu, 10 Oct 2002 09:50:03 +0000 (09:50 +0000)
committerRené Clerc <rene@clerc.nl>
Thu, 10 Oct 2002 09:50:03 +0000 (09:50 +0000)
possible S/MIME default.

send.c

diff --git a/send.c b/send.c
index 85186b56a2acc8f4486581d7d129e73fafd285da..0f7ed7d60625e3cf33f1f9a269592146487f75f0 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1248,28 +1248,41 @@ ci_send_message (int flags,             /* send mode */
        msg->security |= SIGN;
       if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur && cur->security & ENCRYPT)
        msg->security |= SIGN;
-      
-#ifdef HAVE_PGP
-      if (msg->security)
-       msg->security |= APPLICATION_PGP;   /* default is PGP */
-#endif
+    }      
 
+    if (msg->security && cur)
+    {
 #ifdef HAVE_SMIME
-      if (msg->security && ((cur && cur->security & APPLICATION_SMIME) ||
-         option (OPTSMIMEISDEFAULT)))
-      {
+      if (cur->security & APPLICATION_SMIME || option (OPTSMIMEISDEFAULT))
+        msg->security |= APPLICATION_SMIME;
+#endif
 #ifdef HAVE_PGP
-    /* if not both.. */
-       msg->security ^= APPLICATION_PGP;
+      if (cur->security & APPLICATION_PGP)
+      {
+#ifdef HAVE_SMIME
+        if (option (OPTSMIMEISDEFAULT))
+          msg->security ^= APPLICATION_SMIME;
 #endif
-       msg->security |= APPLICATION_SMIME;
+        msg->security |= APPLICATION_PGP;
       }
-#endif /* HAVE_SMIME */
+#endif /* HAVE_PGP */
+    }
+    else if (msg->security)
+    {
+#ifdef HAVE_PGP
+      msg->security |= APPLICATION_PGP;
+#ifdef HAVE_SMIME
+      if (option (OPTSMIMEISDEFAULT))
+      {
+        msg->security |= APPLICATION_SMIME;
+        msg->security ^= APPLICATION_PGP;
+      }
+#endif
+#endif /* HAVE_PGP */
     }
 #endif /* HAVE_PGP || HAVE_SMIME */
 
 
-
   }
   /* wait until now to set the real name portion of our return address so
      that $realname can be set in a send-hook */