** This variable controls whether or not attachments on outgoing messages
** are saved along with the main body of your message.
*/
+ { "fcc_before_send", DT_BOOL, R_NONE, OPTFCCBEFORESEND, 0 },
+ /*
+ ** .pp
+ ** When this variable is \fIset\fP, FCCs will occur before sending
+ ** the message. Before sending, the message cannot be manipulated,
+ ** so it will be stored the exact same as sent:
+ ** $$fcc_attach and $$fcc_clear will be ignored (using their default
+ ** values).
+ ** .pp
+ ** When \fIunset\fP, the default, FCCs will occur after sending.
+ ** Variables $$fcc_attach and $$fcc_clear will be respected, allowing
+ ** it to be stored without attachments or encryption/signing if
+ ** desired.
+ */
{ "fcc_clear", DT_BOOL, R_NONE, OPTFCCCLEAR, 0 },
/*
** .pp
if (!(*fcc && mutt_strcmp ("/dev/null", fcc)))
return rc;
- if (WithCrypto && (msg->security & (ENCRYPT | SIGN)) && option (OPTFCCCLEAR))
+ /* Before sending, we don't allow message manipulation because it
+ * will break message signatures. This is especially complicated by
+ * Protected Headers. */
+ if (!option (OPTFCCBEFORESEND))
{
- msg->content = clear_content;
- msg->security &= ~(ENCRYPT | SIGN);
- mutt_free_envelope (&msg->content->mime_headers);
- }
+ if (WithCrypto && (msg->security & (ENCRYPT | SIGN)) && option (OPTFCCCLEAR))
+ {
+ msg->content = clear_content;
+ msg->security &= ~(ENCRYPT | SIGN);
+ mutt_free_envelope (&msg->content->mime_headers);
+ }
- /* check to see if the user wants copies of all attachments */
- if (query_quadoption (OPT_FCCATTACH, _("Save attachments in Fcc?")) != MUTT_YES &&
- msg->content->type == TYPEMULTIPART)
- {
- if (WithCrypto
- && (msg->security & (ENCRYPT | SIGN))
- && (mutt_strcmp (msg->content->subtype, "encrypted") == 0 ||
- mutt_strcmp (msg->content->subtype, "signed") == 0))
+ /* check to see if the user wants copies of all attachments */
+ if (query_quadoption (OPT_FCCATTACH, _("Save attachments in Fcc?")) != MUTT_YES &&
+ msg->content->type == TYPEMULTIPART)
{
- if (clear_content->type == TYPEMULTIPART)
+ if (WithCrypto
+ && (msg->security & (ENCRYPT | SIGN))
+ && (mutt_strcmp (msg->content->subtype, "encrypted") == 0 ||
+ mutt_strcmp (msg->content->subtype, "signed") == 0))
{
- if (!(msg->security & ENCRYPT) && (msg->security & SIGN))
+ if (clear_content->type == TYPEMULTIPART)
{
- /* save initial signature and attachments */
- save_sig = msg->content->parts->next;
- save_parts = clear_content->parts->next;
- }
+ if (!(msg->security & ENCRYPT) && (msg->security & SIGN))
+ {
+ /* save initial signature and attachments */
+ save_sig = msg->content->parts->next;
+ save_parts = clear_content->parts->next;
+ }
- /* this means writing only the main part */
- msg->content = clear_content->parts;
+ /* this means writing only the main part */
+ msg->content = clear_content->parts;
- if (mutt_protect (msg, pgpkeylist) == -1)
- {
- /* we can't do much about it at this point, so
- * fallback to saving the whole thing to fcc
- */
- msg->content = tmpbody;
- save_sig = NULL;
- goto full_fcc;
- }
+ if (mutt_protect (msg, pgpkeylist) == -1)
+ {
+ /* we can't do much about it at this point, so
+ * fallback to saving the whole thing to fcc
+ */
+ msg->content = tmpbody;
+ save_sig = NULL;
+ goto full_fcc;
+ }
- save_content = msg->content;
+ save_content = msg->content;
+ }
}
+ else
+ msg->content = msg->content->parts;
}
- else
- msg->content = msg->content->parts;
}
full_fcc:
}
}
- msg->content = tmpbody;
-
- if (WithCrypto && save_sig)
+ if (!option (OPTFCCBEFORESEND))
{
- /* cleanup the second signature structures */
- if (save_content->parts)
+ msg->content = tmpbody;
+
+ if (WithCrypto && save_sig)
{
- mutt_free_body (&save_content->parts->next);
- save_content->parts = NULL;
- }
- mutt_free_body (&save_content);
+ /* cleanup the second signature structures */
+ if (save_content->parts)
+ {
+ mutt_free_body (&save_content->parts->next);
+ save_content->parts = NULL;
+ }
+ mutt_free_body (&save_content);
- /* restore old signature and attachments */
- msg->content->parts->next = save_sig;
- msg->content->parts->parts->next = save_parts;
- }
- else if (WithCrypto && save_content)
- {
- /* destroy the new encrypted body. */
- mutt_free_body (&save_content);
+ /* restore old signature and attachments */
+ msg->content->parts->next = save_sig;
+ msg->content->parts->parts->next = save_parts;
+ }
+ else if (WithCrypto && save_content)
+ {
+ /* destroy the new encrypted body. */
+ mutt_free_body (&save_content);
+ }
}
return rc;
mutt_prepare_envelope (msg->env, 1);
+ if (option (OPTFCCBEFORESEND))
+ save_fcc (msg, fcc, sizeof(fcc), clear_content, pgpkeylist, flags);
+
if ((i = send_message (msg)) < 0)
{
if (!(flags & SENDBATCH))
}
}
- save_fcc (msg, fcc, sizeof(fcc), clear_content, pgpkeylist, flags);
+ if (!option (OPTFCCBEFORESEND))
+ save_fcc (msg, fcc, sizeof(fcc), clear_content, pgpkeylist, flags);
if (!option (OPTNOCURSES) && ! (flags & SENDMAILX))
{