** will be saved for later references. Also see ``$$record'',
** ``$$save_name'', ``$$force_name'' and ``$fcc-hook''.
*/
+ { "crypt_autopgp", DT_BOOL, R_NONE, OPTCRYPTAUTOPGP, 1 },
+ /*
+ ** .pp
+ ** This variable controls whether or not mutt may automatically enable
+ ** PGP encryption/signing for messages. See also ``$$crypt_autoencrypt'',
+ ** ``$$crypt_replyencrypt'',
+ ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+ */
+ { "crypt_autosmime", DT_BOOL, R_NONE, OPTCRYPTAUTOSMIME, 1 },
+ /*
+ ** .pp
+ ** This variable controls whether or not mutt may automatically enable
+ ** S/MIME encryption/signing for messages. See also ``$$crypt_autoencrypt'',
+ ** ``$$crypt_replyencrypt'',
+ ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+ */
{ "date_format", DT_STR, R_BOTH, UL &DateFmt, UL "!%a, %b %d, %Y at %I:%M:%S%p %Z" },
/*
** .pp
** Setting this variable will cause Mutt to always attempt to
** cryptographically sign outgoing messages. This can be overridden
** by use of the \fIpgp-menu\fP, when signing is not required or
- ** encryption is requested as well. IF ``$$smime_is_default'' is set,
+ ** encryption is requested as well. If ``$$smime_is_default'' is set,
** then OpenSSL is used instead to create S/MIME messages and settings can
** be overridden by use of the \fIsmime-menu\fP.
** (Crypto only)
** operations. To override and to use OpenSSL instead this must be set.
** However, this has no effect while replying, since mutt will automatically
** select the same application that was used to sign/encrypt the original
- ** message.
+ ** message. (Note that this variable can be overridden by unsetting $$crypt_autosmime.)
** (S/MIME only)
*/
{ "smime_ask_cert_label", DT_BOOL, R_NONE, OPTASKCERTLABEL, 1 },
msg->security |= ENCRYPT;
if (option (OPTCRYPTREPLYSIGN) && cur && (cur->security & SIGN))
msg->security |= SIGN;
- if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur && cur->security & ENCRYPT)
+ if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur && (cur->security & ENCRYPT))
msg->security |= SIGN;
}
- if (WithCrypto && msg->security && cur)
+ if (WithCrypto && msg->security)
{
- if ((WithCrypto & APPLICATION_SMIME)
- && ((cur->security & APPLICATION_SMIME)
- || option (OPTSMIMEISDEFAULT)))
- msg->security |= APPLICATION_SMIME;
-
- if ((WithCrypto & APPLICATION_PGP) && (cur->security & APPLICATION_PGP))
+ /*
+ * When reypling / forwarding, use the original message's
+ * crypto system. According to the documentation,
+ * smime_is_default should be disregarded here.
+ *
+ * Problem: At least with forwarding, this doesn't really
+ * make much sense. Should we have an option to completely
+ * disable individual mechanisms at run-time?
+ */
+ if (cur)
{
- msg->security &= ~APPLICATION_SMIME;
- msg->security |= APPLICATION_PGP;
+ if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)
+ && (cur->security & APPLICATION_PGP))
+ msg->security |= APPLICATION_PGP;
+ else if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
+ && (cur->security & APPLICATION_SMIME))
+ msg->security |= APPLICATION_SMIME;
}
- if ((WithCrypto & APPLICATION_SMIME)
- && !(cur->security & (APPLICATION_PGP|APPLICATION_SMIME)))
- msg->security |= APPLICATION_PGP;
- }
- else if ((WithCrypto & APPLICATION_PGP) && msg->security)
- {
- msg->security |= APPLICATION_PGP;
- if ((WithCrypto & APPLICATION_SMIME) && option (OPTSMIMEISDEFAULT))
+
+ /*
+ * No crypto mechanism selected? Use availability + smime_is_default
+ * for the decision.
+ */
+ if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP)))
{
- msg->security |= APPLICATION_SMIME;
- msg->security &= ~APPLICATION_PGP;
+ if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
+ && option (OPTSMIMEISDEFAULT))
+ msg->security |= APPLICATION_SMIME;
+ else if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP))
+ msg->security |= APPLICATION_PGP;
+ else if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME))
+ msg->security |= APPLICATION_SMIME;
}
}
-
+
+ /* No permissible mechanisms found. Don't sign or encrypt. */
+ if (!(msg->security & (APPLICATION_SMIME|APPLICATION_PGP)))
+ msg->security = 0;
}
/* wait until now to set the real name portion of our return address so
that $realname can be set in a send-hook */