From: Kevin McCarthy Date: Thu, 12 Mar 2015 21:48:48 +0000 (-0700) Subject: Allow attachments from unencrypted emails to be deleted. X-Git-Tag: neomutt-20160307~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc55a3d2bf63abe2d8fed7d0a839001bc9f85c40;p=neomutt Allow attachments from unencrypted emails to be deleted. Print a warning if the message is signed or partly signed. Thanks to David Haguenauer for the original patch! --- diff --git a/recvattach.c b/recvattach.c index 31dfcadd5..245204974 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1119,50 +1119,53 @@ void mutt_view_attachments (HEADER *hdr) } #endif - if (WithCrypto && hdr->security & ~PGP_TRADITIONAL_CHECKED) + if (WithCrypto && (hdr->security & ENCRYPT)) { - mutt_message _( - "Deletion of attachments from encrypted messages is unsupported."); - } + mutt_message _( + "Deletion of attachments from encrypted messages is unsupported."); + break; + } + if (WithCrypto && (hdr->security & (SIGN | PARTSIGN))) + { + mutt_message _( + "Deletion of attachments from signed messages may invalidate the signature."); + } + if (!menu->tagprefix) + { + if (idx[menu->current]->parent_type == TYPEMULTIPART) + { + idx[menu->current]->content->deleted = 1; + if (option (OPTRESOLVE) && menu->current < menu->max - 1) + { + menu->current++; + menu->redraw = REDRAW_MOTION_RESYNCH; + } + else + menu->redraw = REDRAW_CURRENT; + } + else + mutt_message _( + "Only deletion of multipart attachments is supported."); + } else { - if (!menu->tagprefix) - { - if (idx[menu->current]->parent_type == TYPEMULTIPART) - { - idx[menu->current]->content->deleted = 1; - if (option (OPTRESOLVE) && menu->current < menu->max - 1) - { - menu->current++; - menu->redraw = REDRAW_MOTION_RESYNCH; - } - else - menu->redraw = REDRAW_CURRENT; - } - else - mutt_message _( - "Only deletion of multipart attachments is supported."); - } - else - { - int x; - - for (x = 0; x < menu->max; x++) - { - if (idx[x]->content->tagged) - { - if (idx[x]->parent_type == TYPEMULTIPART) - { - idx[x]->content->deleted = 1; - menu->redraw = REDRAW_INDEX; - } - else - mutt_message _( - "Only deletion of multipart attachments is supported."); - } - } - } - } + int x; + + for (x = 0; x < menu->max; x++) + { + if (idx[x]->content->tagged) + { + if (idx[x]->parent_type == TYPEMULTIPART) + { + idx[x]->content->deleted = 1; + menu->redraw = REDRAW_INDEX; + } + else + mutt_message _( + "Only deletion of multipart attachments is supported."); + } + } + } break; case OP_UNDELETE: