== END PATCH
--- a/commands.c
+++ b/commands.c
-@@ -716,6 +716,7 @@
+@@ -717,6 +717,7 @@
if (option (OPTDELETEUNTAG))
mutt_set_flag (Context, h, M_TAG, 0);
}
WHERE char *XtermTitle;
--- a/imap/message.c
+++ b/imap/message.c
-@@ -867,6 +867,7 @@
+@@ -876,6 +876,7 @@
if (ctx->hdrs[n]->tagged)
{
mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);
if (option (OPTDELETEUNTAG))
mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);
}
-@@ -874,6 +875,7 @@
+@@ -883,6 +884,7 @@
else
{
mutt_set_flag (ctx, h, M_DELETE, 1);
}
--- a/init.h
+++ b/init.h
-@@ -3190,6 +3190,16 @@
+@@ -3195,6 +3195,16 @@
** by \fIyou\fP. The sixth character is used to indicate when a mail
** was sent to a mailing-list you subscribe to.
*/
M_FLAG,
M_TAG,
M_UNTAG,
-@@ -703,6 +704,7 @@
+@@ -707,6 +708,7 @@
unsigned int mime : 1; /* has a MIME-Version header? */
unsigned int flagged : 1; /* marked important? */
unsigned int tagged : 1;
unsigned int deleted : 1;
unsigned int changed : 1;
unsigned int attach_del : 1; /* has an attachment marked for deletion */
-@@ -875,6 +877,7 @@
+@@ -879,6 +881,7 @@
int new; /* how many new messages? */
int unread; /* how many unread messages? */
int deleted; /* how many deleted messages */
--- a/muttlib.c
+++ b/muttlib.c
-@@ -1460,7 +1460,9 @@
+@@ -1515,7 +1515,9 @@
if (magic > 0 && !mx_access (s, W_OK))
{
if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
--- a/mx.c
+++ b/mx.c
-@@ -773,6 +773,53 @@
+@@ -776,6 +776,53 @@
return rc;
}
/* save changes and close mailbox */
int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
{
-@@ -909,6 +956,7 @@
+@@ -912,6 +959,7 @@
if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
{
mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1);
}
else
{
-@@ -931,6 +979,14 @@
+@@ -936,6 +984,14 @@
return 0;
}
#ifdef USE_IMAP
/* allow IMAP to preserve the deleted flag across sessions */
if (ctx->magic == M_IMAP)
-@@ -1130,6 +1186,12 @@
+@@ -1133,6 +1189,12 @@
msgcount = ctx->msgcount;
deleted = ctx->deleted;
+ {
+ if (trash_append (ctx) == -1)
+ return -1;
-+ }
++ }
+
#ifdef USE_IMAP
if (ctx->magic == M_IMAP)
rc = imap_sync_mailbox (ctx, purge, index_hint);
--- a/postpone.c
+++ b/postpone.c
-@@ -276,6 +276,9 @@
+@@ -277,6 +277,9 @@
/* finished with this message, so delete it. */
mutt_set_flag (PostContext, h, M_DELETE, 1);