From fc55a3d2bf63abe2d8fed7d0a839001bc9f85c40 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Thu, 12 Mar 2015 14:48:48 -0700 Subject: [PATCH] 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! --- recvattach.c | 85 +++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) 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: -- 2.40.0