]> granicus.if.org Git - neomutt/commitdiff
In compose menu, detach should be able to unlink files generated by mutt,
authorBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 14:39:56 +0000 (14:39 +0000)
committerBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 14:39:56 +0000 (14:39 +0000)
but not files that existed before.

compose.c
mutt.h

index eab1b26b16cc3c83b847294cb0cf3341bdf8e741..8f216d4f22355027fab8ffd188ca4cf0ad36d990 100644 (file)
--- 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 ec2a4fa63b7050f6798304bf78363b4d7f0a82a1..7df4f644d974b7b1b49c5c98dee9dded7facd5ff 100644 (file)
--- 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