always build mutt with pgp + smime support.
[apps/madmutt.git] / send.c
diff --git a/send.c b/send.c
index 7b4b9bc..8ba9c3c 100644 (file)
--- a/send.c
+++ b/send.c
@@ -396,7 +396,7 @@ static int include_forward (CONTEXT * ctx, HEADER * cur, FILE * out)
   mutt_parse_mime_message (ctx, cur);
   mutt_message_hook (ctx, cur, M_MESSAGEHOOK);
 
-  if (WithCrypto && (cur->security & ENCRYPT) && option (OPTFORWDECODE)) {
+  if ((cur->security & ENCRYPT) && option (OPTFORWDECODE)) {
     /* make sure we have the user's passphrase before proceeding... */
     crypt_valid_passphrase (cur->security);
   }
@@ -445,7 +445,7 @@ static int include_reply (CONTEXT * ctx, HEADER * cur, FILE * out)
   int cmflags = M_CM_PREFIX | M_CM_DECODE | M_CM_CHARCONV | M_CM_REPLYING;
   int chflags = CH_DECODE;
 
-  if (WithCrypto && (cur->security & ENCRYPT)) {
+  if ((cur->security & ENCRYPT)) {
     /* make sure we have the user's passphrase before proceeding... */
     crypt_valid_passphrase (cur->security);
   }
@@ -855,12 +855,10 @@ static int generate_body (FILE * tempfp,        /* stream for outgoing message *
     else if (i == -1)
       return -1;
   }
-  /* if (WithCrypto && (flags & SENDKEY)) */
-  else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)) {
+  else if (flags & SENDKEY) {
     BODY *tmp;
 
-    if ((WithCrypto & APPLICATION_PGP)
-        && (tmp = crypt_pgp_make_key_attachment (NULL)) == NULL)
+    if ((tmp = crypt_pgp_make_key_attachment (NULL)) == NULL)
       return -1;
 
     tmp->next = msg->content;
@@ -1128,7 +1126,7 @@ int ci_send_message (int flags, /* send mode */
   }
 
 
-  if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED))
+  if (flags & SENDPOSTPONED)
     signas = m_strdup(PgpSignAs);
 
   /* Delay expansion of aliases until absolutely necessary--shouldn't
@@ -1333,7 +1331,7 @@ int ci_send_message (int flags, /* send mode */
      * can take effect.
      */
 
-    if (WithCrypto && !(flags & SENDMAILX)) {
+    if (!(flags & SENDMAILX)) {
       if (option (OPTCRYPTAUTOSIGN))
         msg->security |= SIGN;
       if (option (OPTCRYPTAUTOENCRYPT))
@@ -1345,7 +1343,7 @@ int ci_send_message (int flags, /* send mode */
       if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur
           && (cur->security & ENCRYPT))
         msg->security |= SIGN;
-      if (WithCrypto & APPLICATION_PGP && (msg->security & (ENCRYPT | SIGN))) {
+      if (msg->security & (ENCRYPT | SIGN)) {
         if (option (OPTPGPAUTOINLINE))
           msg->security |= INLINE;
         if (option (OPTPGPREPLYINLINE) && cur && (cur->security & INLINE))
@@ -1353,7 +1351,7 @@ int ci_send_message (int flags, /* send mode */
       }
     }
 
-    if (WithCrypto && msg->security) {
+    if (msg->security) {
       /* 
        * When reypling / forwarding, use the original message's
        * crypto system.  According to the documentation,
@@ -1364,11 +1362,9 @@ int ci_send_message (int flags, /* send mode */
        * disable individual mechanisms at run-time?
        */
       if (cur) {
-        if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)
-            && (cur->security & APPLICATION_PGP))
+        if (option (OPTCRYPTAUTOPGP) && (cur->security & APPLICATION_PGP))
           msg->security |= APPLICATION_PGP;
-        else if ((WithCrypto & APPLICATION_SMIME)
-                 && option (OPTCRYPTAUTOSMIME)
+        else if (option (OPTCRYPTAUTOSMIME)
                  && (cur->security & APPLICATION_SMIME))
           msg->security |= APPLICATION_SMIME;
       }
@@ -1378,13 +1374,11 @@ int ci_send_message (int flags, /* send mode */
        * for the decision. 
        */
       if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) {
-        if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
-            && option (OPTSMIMEISDEFAULT))
+        if (option (OPTCRYPTAUTOSMIME) && option (OPTSMIMEISDEFAULT))
           msg->security |= APPLICATION_SMIME;
-        else if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP))
+        else if (option (OPTCRYPTAUTOPGP))
           msg->security |= APPLICATION_PGP;
-        else if ((WithCrypto & APPLICATION_SMIME)
-                 && option (OPTCRYPTAUTOSMIME))
+        else if (option (OPTCRYPTAUTOSMIME))
           msg->security |= APPLICATION_SMIME;
       }
     }
@@ -1407,7 +1401,7 @@ int ci_send_message (int flags, /* send mode */
       && !(flags & (SENDRESEND | SENDPOSTPONED)))
     msg->env->from->personal = m_strdup(Realname);
 
-  if (!((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)))
+  if (!(flags & SENDKEY))
     safe_fclose (&tempfp);
 
   if (flags & SENDMAILX) {
@@ -1634,38 +1628,36 @@ int ci_send_message (int flags, /* send mode */
   clear_content = NULL;
   free_clear_content = 0;
 
-  if (WithCrypto) {
-    if (msg->security) {
-      /* save the decrypted attachments */
-      clear_content = msg->content;
+  if (msg->security) {
+    /* save the decrypted attachments */
+    clear_content = msg->content;
 
-      if ((crypt_get_keys (msg, &pgpkeylist) == -1) ||
-          mutt_protect (msg, pgpkeylist) == -1) {
-        msg->content = mutt_remove_multipart (msg->content);
+    if ((crypt_get_keys (msg, &pgpkeylist) == -1) ||
+        mutt_protect (msg, pgpkeylist) == -1) {
+      msg->content = mutt_remove_multipart (msg->content);
 
-        p_delete(&pgpkeylist);
+      p_delete(&pgpkeylist);
 
-        decode_descriptions (msg->content);
-        goto main_loop;
-      }
-      encode_descriptions (msg->content, 0);
+      decode_descriptions (msg->content);
+      goto main_loop;
     }
+    encode_descriptions (msg->content, 0);
+  }
 
-    /* 
-     * at this point, msg->content is one of the following three things:
-     * - multipart/signed.  In this case, clear_content is a child.
-     * - multipart/encrypted.  In this case, clear_content exists
-     *   independently
-     * - application/pgp.  In this case, clear_content exists independently.
-     * - something else.  In this case, it's the same as clear_content.
-     */
+  /* 
+   * at this point, msg->content is one of the following three things:
+   * - multipart/signed.  In this case, clear_content is a child.
+   * - multipart/encrypted.  In this case, clear_content exists
+   *   independently
+   * - application/pgp.  In this case, clear_content exists independently.
+   * - something else.  In this case, it's the same as clear_content.
+   */
 
-    /* This is ugly -- lack of "reporting back" from mutt_protect(). */
+  /* This is ugly -- lack of "reporting back" from mutt_protect(). */
 
-    if (clear_content && (msg->content != clear_content)
-        && (msg->content->parts != clear_content))
-      free_clear_content = 1;
-  }
+  if (clear_content && (msg->content != clear_content)
+      && (msg->content->parts != clear_content))
+    free_clear_content = 1;
 
   if (!option (OPTNOCURSES) && !(flags & SENDMAILX))
     mutt_message _("Sending message...");
@@ -1696,14 +1688,14 @@ int ci_send_message (int flags, /* send mode */
     BODY *save_sig = NULL;
     BODY *save_parts = NULL;
 
-    if (WithCrypto && msg->security && option (OPTFCCCLEAR))
+    if (msg->security && option (OPTFCCCLEAR))
       msg->content = clear_content;
 
     /* check to see if the user wants copies of all attachments */
     if (!option (OPTFCCATTACH) && msg->content->type == TYPEMULTIPART) {
-      if (WithCrypto
-          && (m_strcmp(msg->content->subtype, "encrypted") == 0 ||
-              m_strcmp(msg->content->subtype, "signed") == 0)) {
+      if ((m_strcmp(msg->content->subtype, "encrypted") == 0 ||
+              m_strcmp(msg->content->subtype, "signed") == 0))
+      {
         if (clear_content->type == TYPEMULTIPART) {
           if (!(msg->security & ENCRYPT) && (msg->security & SIGN)) {
             /* save initial signature and attachments */
@@ -1747,7 +1739,7 @@ int ci_send_message (int flags, /* send mode */
 
     msg->content = tmpbody;
 
-    if (WithCrypto && save_sig) {
+    if (save_sig) {
       /* cleanup the second signature structures */
       if (save_content->parts) {
         mutt_free_body (&save_content->parts->next);
@@ -1759,7 +1751,7 @@ int ci_send_message (int flags, /* send mode */
       msg->content->parts->next = save_sig;
       msg->content->parts->parts->next = save_parts;
     }
-    else if (WithCrypto && save_content) {
+    else if (save_content) {
       /* destroy the new encrypted body. */
       mutt_free_body (&save_content);
     }
@@ -1774,10 +1766,9 @@ int ci_send_message (int flags, /* send mode */
    */
   if (fcc_error || (i = send_message (msg)) == -1) {
     if (!(flags & SENDBATCH)) {
-      if (!WithCrypto);
-      else if ((msg->security & ENCRYPT) || ((msg->security & SIGN)
-                                             && msg->content->type ==
-                                             TYPEAPPLICATION)) {
+      if ((msg->security & ENCRYPT)
+      ||  ((msg->security & SIGN)
+      &&  msg->content->type == TYPEAPPLICATION)) {
         mutt_free_body (&msg->content); /* destroy PGP data */
         msg->content = clear_content;   /* restore clear text. */
       }
@@ -1806,10 +1797,10 @@ int ci_send_message (int flags, /* send mode */
                   _("Mail sent."));
 #endif
 
-  if (WithCrypto && (msg->security & ENCRYPT))
+  if (msg->security & ENCRYPT)
     p_delete(&pgpkeylist);
 
-  if (WithCrypto && free_clear_content)
+  if (free_clear_content)
     mutt_free_body (&clear_content);
 
   if (flags & SENDREPLY) {
@@ -1827,7 +1818,7 @@ int ci_send_message (int flags, /* send mode */
 
 cleanup:
 
-  if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED)) {
+  if (flags & SENDPOSTPONED) {
     if (signas) {
       p_delete(&PgpSignAs);
       PgpSignAs = signas;