From cb7ef1679a71caaee8387dbd621e2bceb1b35b97 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Tue, 2 Aug 2005 14:39:56 +0000 Subject: [PATCH] In compose menu, detach should be able to unlink files generated by mutt, but not files that existed before. --- compose.c | 4 +++- mutt.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compose.c b/compose.c index eab1b26b1..8f216d4f2 100644 --- a/compose.c +++ b/compose.c @@ -686,6 +686,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ { char *att = files[i]; idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR)); + idx[idxlen]->unowned = 1; idx[idxlen]->content = mutt_make_file_attach (att); if (idx[idxlen]->content != NULL) update_idx (menu, idx, idxlen++); @@ -814,7 +815,8 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ case OP_DELETE: CHECK_COUNT; - idx[menu->current]->content->unlink = 0; + if (idx[menu->current]->unowned) + idx[menu->current]->content->unlink = 0; if (delete_attachment (menu, &idxlen, menu->current) == -1) break; mutt_update_tree (idx, idxlen); diff --git a/mutt.h b/mutt.h index ec2a4fa63..7df4f644d 100644 --- a/mutt.h +++ b/mutt.h @@ -855,6 +855,7 @@ typedef struct attachptr char *tree; int level; int num; + unsigned int unowned : 1; /* don't unlink on detach */ } ATTACHPTR; typedef struct -- 2.40.0