···
1
+
diff -urN mutt-1.6.1/commands.c mutt-1.6.1-trash/commands.c
2
+
--- mutt-1.6.1/commands.c 2016-06-12 18:43:00.397447512 +0100
3
+
+++ mutt-1.6.1-trash/commands.c 2016-06-12 18:43:04.892517610 +0100
5
+
if (option (OPTDELETEUNTAG))
6
+
mutt_set_flag (Context, h, M_TAG, 0);
8
+
+ mutt_set_flag (Context, h, M_APPENDED, 1);
12
+
diff -urN mutt-1.6.1/curs_main.c mutt-1.6.1-trash/curs_main.c
13
+
--- mutt-1.6.1/curs_main.c 2016-06-12 18:43:00.399447544 +0100
14
+
+++ mutt-1.6.1-trash/curs_main.c 2016-06-12 18:43:04.895517656 +0100
15
+
@@ -1919,6 +1919,7 @@
16
+
MAYBE_REDRAW (menu->redraw);
19
+
+ case OP_PURGE_MESSAGE:
23
+
@@ -1930,6 +1931,7 @@
26
+
mutt_tag_set_flag (M_DELETE, 1);
27
+
+ mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
28
+
if (option (OPTDELETEUNTAG))
29
+
mutt_tag_set_flag (M_TAG, 0);
30
+
menu->redraw = REDRAW_INDEX;
31
+
@@ -1937,6 +1939,8 @@
34
+
mutt_set_flag (Context, CURHDR, M_DELETE, 1);
35
+
+ mutt_set_flag (Context, CURHDR, M_PURGED,
36
+
+ (op != OP_PURGE_MESSAGE) ? 0 : 1);
37
+
if (option (OPTDELETEUNTAG))
38
+
mutt_set_flag (Context, CURHDR, M_TAG, 0);
39
+
if (option (OPTRESOLVE))
40
+
@@ -2242,11 +2246,13 @@
43
+
mutt_tag_set_flag (M_DELETE, 0);
44
+
+ mutt_tag_set_flag (M_PURGED, 0);
45
+
menu->redraw = REDRAW_INDEX;
49
+
mutt_set_flag (Context, CURHDR, M_DELETE, 0);
50
+
+ mutt_set_flag (Context, CURHDR, M_PURGED, 0);
51
+
if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)
54
+
@@ -2268,9 +2274,11 @@
55
+
CHECK_ACL(M_ACL_DELETE, _("Cannot undelete message(s)"));
57
+
rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
58
+
- op == OP_UNDELETE_THREAD ? 0 : 1);
59
+
+ op == OP_UNDELETE_THREAD ? 0 : 1)
60
+
+ + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
61
+
+ (op == OP_UNDELETE_THREAD) ? 0 : 1);
66
+
if (option (OPTRESOLVE))
68
+
diff -urN mutt-1.6.1/doc/manual.xml.head mutt-1.6.1-trash/doc/manual.xml.head
69
+
--- mutt-1.6.1/doc/manual.xml.head 2016-06-12 18:43:00.402447590 +0100
70
+
+++ mutt-1.6.1-trash/doc/manual.xml.head 2016-06-12 18:43:04.901517750 +0100
71
+
@@ -7467,6 +7467,16 @@
75
+
+<sect2 id="mutt-patches">
76
+
+<title>Mutt Patches</title>
78
+
+Mutt may also be <quote>patched</quote> to support smaller features.
79
+
+These patches should add a free-form string to the end Mutt's version string.
80
+
+Running <literal>mutt -v</literal> might show:
81
+
+<screen>patch-1.6.1.sidebar.20160502</screen>
85
+
<sect2 id="url-syntax">
86
+
<title>URL Syntax</title>
88
+
@@ -8081,6 +8091,175 @@
92
+
+<sect1 id="trash-folder">
93
+
+ <title>Trash Folder Patch</title>
94
+
+ <subtitle>Automatically move "deleted" emails to a trash bin</subtitle>
96
+
+ <sect2 id="trash-folder-patch">
97
+
+ <title>Patch</title>
100
+
+ To check if Mutt supports <quote>Trash Folder</quote>, look for
101
+
+ <quote>patch-trash</quote> in the mutt version.
102
+
+ See: <xref linkend="mutt-patches"/>.
105
+
+ If IMAP is enabled, this patch will use it
108
+
+ <title>Dependencies:</title>
109
+
+ <listitem><para>mutt-1.6.1</para></listitem>
110
+
+ <listitem><para>IMAP support</para></listitem>
113
+
+ <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
116
+
+ <sect2 id="trash-folder-intro">
117
+
+ <title>Introduction</title>
120
+
+ In Mutt, when you <quote>delete</quote> an email it is first marked
121
+
+ deleted. The email isn't really gone until
122
+
+ <link linkend="index-map"><sync-mailbox></link> is called.
123
+
+ This happens when the user leaves the folder, or the function is called
128
+
+ After <literal><sync-mailbox></literal> has been called the email is gone forever.
132
+
+ The <link linkend="trash">$trash</link> variable defines a folder in
133
+
+ which to keep old emails. As before, first you mark emails for
134
+
+ deletion. When <sync-mailbox> is called the emails are moved to
135
+
+ the trash folder.
139
+
+ The <literal>$trash</literal> path can be either a full directory,
140
+
+ or be relative to the <link linkend="folder">$folder</link>
141
+
+ variable, like the <literal>mailboxes</literal> command.
145
+
+ Emails deleted from the trash folder are gone forever.
149
+
+ <sect2 id="trash-folder-variables">
150
+
+ <title>Variables</title>
151
+
+ <table id="table-trash-variables">
152
+
+ <title>Trash Variables</title>
153
+
+ <tgroup cols="3">
156
+
+ <entry>Name</entry>
157
+
+ <entry>Type</entry>
158
+
+ <entry>Default</entry>
163
+
+ <entry>trash</entry>
164
+
+ <entry>string</entry>
165
+
+ <entry>(none)</entry>
172
+
+ <sect2 id="trash-folder-functions">
173
+
+ <title>Functions</title>
174
+
+ <table id="table-trash-functions">
175
+
+ <title>Trash Functions</title>
176
+
+ <tgroup cols="4">
179
+
+ <entry>Menus</entry>
180
+
+ <entry>Default Key</entry>
181
+
+ <entry>Function</entry>
182
+
+ <entry>Description</entry>
187
+
+ <entry>index,pager</entry>
188
+
+ <entry>(none)</entry>
189
+
+ <entry><literal><purge-message></literal></entry>
190
+
+ <entry>really delete the current entry, bypassing the trash folder</entry>
198
+
+ <sect2 id="trash-folder-commands">
199
+
+ <title>Commands</title>
200
+
+ <para>None</para>
203
+
+ <sect2 id="trash-folder-colors">
204
+
+ <title>Colors</title>
205
+
+ <para>None</para>
208
+
+ <sect2 id="trash-folder-sort">
209
+
+ <title>Sort</title>
210
+
+ <para>None</para>
214
+
+ <sect2 id="trash-folder-muttrc">
215
+
+ <title>Muttrc</title>
217
+
+<emphasis role="comment"># Example Mutt config file for the 'trash' feature.
219
+
+# This feature defines a new 'trash' folder.
220
+
+# When mail is deleted it will be moved to this folder.
222
+
+# Folder in which to put deleted emails</emphasis>
223
+
+set trash='+Trash'
224
+
+set trash='/home/flatcap/Mail/Trash'
226
+
+<emphasis role="comment"># The default delete key 'd' will move an email to the 'trash' folder
227
+
+# Bind 'D' to REALLY delete an email</emphasis>
228
+
+bind index D purge-message
230
+
+<emphasis role="comment"># Note: Deleting emails from the 'trash' folder will REALLY delete them.
232
+
+# vim: syntax=muttrc</emphasis>
236
+
+ <sect2 id="trash-folder-see-also">
237
+
+ <title>See Also</title>
240
+
+ <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
241
+
+ <listitem><para><link linkend="folder-hook">folder-hook</link></para></listitem>
245
+
+ <sect2 id="trash-folder-known-bugs">
246
+
+ <title>Known Bugs</title>
247
+
+ <para>None</para>
250
+
+ <sect2 id="trash-folder-credits">
251
+
+ <title>Credits</title>
253
+
+ <listitem><para>Cedric Duval <email>cedricduval@free.fr</email></para></listitem>
254
+
+ <listitem><para>Benjamin Kuperman <email>kuperman@acm.org</email></para></listitem>
255
+
+ <listitem><para>Paul Miller <email>paul@voltar.org</email></para></listitem>
256
+
+ <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
263
+
<chapter id="security">
264
+
diff -urN mutt-1.6.1/doc/muttrc.trash mutt-1.6.1-trash/doc/muttrc.trash
265
+
--- mutt-1.6.1/doc/muttrc.trash 1970-01-01 01:00:00.000000000 +0100
266
+
+++ mutt-1.6.1-trash/doc/muttrc.trash 2016-06-12 18:43:04.768515676 +0100
268
+
+# Example Mutt config file for the 'trash' feature.
270
+
+# This feature defines a new 'trash' folder.
271
+
+# When mail is deleted it will be moved to this folder.
273
+
+# Folder in which to put deleted emails
274
+
+set trash='+Trash'
275
+
+set trash='/home/flatcap/Mail/Trash'
277
+
+# The default delete key 'd' will move an email to the 'trash' folder
278
+
+# Bind 'D' to REALLY delete an email
279
+
+bind index D purge-message
281
+
+# Note: Deleting emails from the 'trash' folder will REALLY delete them.
283
+
+# vim: syntax=muttrc
284
+
diff -urN mutt-1.6.1/doc/vimrc.trash mutt-1.6.1-trash/doc/vimrc.trash
285
+
--- mutt-1.6.1/doc/vimrc.trash 1970-01-01 01:00:00.000000000 +0100
286
+
+++ mutt-1.6.1-trash/doc/vimrc.trash 2016-06-12 18:43:04.769515692 +0100
288
+
+" Vim syntax file for the mutt trash patch
290
+
+syntax keyword muttrcVarStr contained skipwhite trash nextgroup=muttrcVarEqualsIdxFmt
292
+
+syntax match muttrcFunction contained "\<purge-message\>"
295
+
diff -urN mutt-1.6.1/flags.c mutt-1.6.1-trash/flags.c
296
+
--- mutt-1.6.1/flags.c 2016-06-12 18:43:00.403447606 +0100
297
+
+++ mutt-1.6.1-trash/flags.c 2016-06-12 18:43:04.902517766 +0100
302
+
- if (upd_ctx) ctx->deleted--;
305
+
+ if (h->appended) {
309
+
+ h->appended = 0; /* when undeleting, also reset the appended flag */
311
+
/* see my comment above */
312
+
if (ctx->magic == M_IMAP)
319
+
+ if (!h->appended) {
330
+
+ if (!h->purged) {
333
+
+ } else if (h->purged) {
340
+
if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
341
+
diff -urN mutt-1.6.1/functions.h mutt-1.6.1-trash/functions.h
342
+
--- mutt-1.6.1/functions.h 2016-06-12 18:43:00.403447606 +0100
343
+
+++ mutt-1.6.1-trash/functions.h 2016-06-12 18:43:04.902517766 +0100
344
+
@@ -121,6 +121,7 @@
345
+
{ "toggle-write", OP_TOGGLE_WRITE, "%" },
346
+
{ "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
347
+
{ "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
348
+
+ { "purge-message", OP_PURGE_MESSAGE, NULL },
349
+
{ "query", OP_QUERY, "Q" },
350
+
{ "quit", OP_QUIT, "q" },
351
+
{ "reply", OP_REPLY, "r" },
352
+
@@ -213,6 +214,7 @@
353
+
{ "print-message", OP_PRINT, "p" },
354
+
{ "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
355
+
{ "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
356
+
+ { "purge-message", OP_PURGE_MESSAGE, NULL },
357
+
{ "quit", OP_QUIT, "Q" },
358
+
{ "exit", OP_EXIT, "q" },
359
+
{ "reply", OP_REPLY, "r" },
360
+
diff -urN mutt-1.6.1/globals.h mutt-1.6.1-trash/globals.h
361
+
--- mutt-1.6.1/globals.h 2016-06-12 18:43:00.403447606 +0100
362
+
+++ mutt-1.6.1-trash/globals.h 2016-06-12 18:43:04.903517781 +0100
363
+
@@ -141,6 +141,7 @@
364
+
WHERE char *Status;
365
+
WHERE char *Tempdir;
366
+
WHERE char *Tochars;
367
+
+WHERE char *TrashPath;
368
+
WHERE char *TSStatusFormat;
369
+
WHERE char *TSIconFormat;
370
+
WHERE short TSSupported;
371
+
diff -urN mutt-1.6.1/imap/imap.c mutt-1.6.1-trash/imap/imap.c
372
+
--- mutt-1.6.1/imap/imap.c 2016-06-12 18:43:00.405447637 +0100
373
+
+++ mutt-1.6.1-trash/imap/imap.c 2016-06-12 18:43:04.905517812 +0100
374
+
@@ -888,6 +888,12 @@
375
+
if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted)
376
+
match = invert ^ hdrs[n]->deleted;
378
+
+ case M_EXPIRED: /* imap_fast_trash version of M_DELETED */
379
+
+ if (hdrs[n]->purged)
381
+
+ if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted)
382
+
+ match = invert ^ (hdrs[n]->deleted && !hdrs[n]->appended);
385
+
if (hdrs[n]->flagged != HEADER_DATA(hdrs[n])->flagged)
386
+
match = invert ^ hdrs[n]->flagged;
387
+
@@ -2038,3 +2044,53 @@
393
+
+ * imap_fast_trash - XXX
396
+
+imap_fast_trash (void)
398
+
+ if ((Context->magic == M_IMAP) && mx_is_imap (TrashPath)) {
400
+
+ IMAP_DATA *idata = (IMAP_DATA *) Context->data;
401
+
+ char mbox[LONG_STRING];
402
+
+ char mmbox[LONG_STRING];
404
+
+ dprint (1, (debugfile, "[itf] trashcan seems to be on imap.\n"));
406
+
+ if (imap_parse_path (TrashPath, &mx) == 0) {
407
+
+ if (mutt_account_match (&(idata->conn->account), &(mx.account))) {
408
+
+ dprint (1, (debugfile, "[itf] trashcan seems to be on the same account.\n"));
410
+
+ imap_fix_path (idata, mx.mbox, mbox, sizeof (mbox));
412
+
+ strfcpy (mbox, "INBOX", sizeof (mbox));
413
+
+ imap_munge_mbox_name (idata, mmbox, sizeof (mmbox), mbox);
415
+
+ rc = imap_exec_msgset (idata, "UID COPY", mmbox, M_EXPIRED, 0, 0);
417
+
+ dprint (1, (debugfile, "imap_copy_messages: No messages del-tagged\n"));
420
+
+ } else if (rc < 0) {
421
+
+ dprint (1, (debugfile, "could not queue copy\n"));
424
+
+ mutt_message (_("Copying %d messages to %s..."), rc, mbox);
428
+
+ dprint (1, (debugfile, "[itf] trashcan seems to be on a different account.\n"));
431
+
+ FREE(&mx.mbox); /* we probably only need to free this when the parse works */
433
+
+ dprint (1, (debugfile, "[itf] failed to parse TrashPath.\n"));
436
+
+ dprint (1, (debugfile, "[itf] giving up and trying old fasioned way.\n"));
441
+
diff -urN mutt-1.6.1/imap/imap.h mutt-1.6.1-trash/imap/imap.h
442
+
--- mutt-1.6.1/imap/imap.h 2016-06-12 18:43:00.405447637 +0100
443
+
+++ mutt-1.6.1-trash/imap/imap.h 2016-06-12 18:43:04.774515769 +0100
446
+
int imap_account_match (const ACCOUNT* a1, const ACCOUNT* a2);
449
+
+int imap_fast_trash (void);
452
+
diff -urN mutt-1.6.1/imap/message.c mutt-1.6.1-trash/imap/message.c
453
+
--- mutt-1.6.1/imap/message.c 2016-06-12 18:43:00.406447652 +0100
454
+
+++ mutt-1.6.1-trash/imap/message.c 2016-06-12 18:43:04.906517828 +0100
455
+
@@ -886,6 +886,7 @@
456
+
if (ctx->hdrs[n]->tagged)
458
+
mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);
459
+
+ mutt_set_flag (ctx, ctx->hdrs[n], M_APPENDED, 1);
460
+
if (option (OPTDELETEUNTAG))
461
+
mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);
463
+
@@ -893,6 +894,7 @@
466
+
mutt_set_flag (ctx, h, M_DELETE, 1);
467
+
+ mutt_set_flag (ctx, h, M_APPENDED, 1);
468
+
if (option (OPTDELETEUNTAG))
469
+
mutt_set_flag (ctx, h, M_TAG, 0);
471
+
diff -urN mutt-1.6.1/init.h mutt-1.6.1-trash/init.h
472
+
--- mutt-1.6.1/init.h 2016-06-12 18:43:00.408447684 +0100
473
+
+++ mutt-1.6.1-trash/init.h 2016-06-12 18:43:04.909517875 +0100
474
+
@@ -3419,6 +3419,16 @@
475
+
** provided that ``$$ts_enabled'' has been set. This string is identical in
476
+
** formatting to the one used by ``$$status_format''.
478
+
+ { "trash", DT_PATH, R_NONE, UL &TrashPath, 0 },
481
+
+ ** If set, this variable specifies the path of the trash folder where the
482
+
+ ** mails marked for deletion will be moved, instead of being irremediably
485
+
+ ** NOTE: When you delete a message in the trash folder, it is really
486
+
+ ** deleted, so that you have a way to clean the trash.
489
+
{ "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 },
491
+
diff -urN mutt-1.6.1/mutt.h mutt-1.6.1-trash/mutt.h
492
+
--- mutt-1.6.1/mutt.h 2016-06-12 18:43:00.410447715 +0100
493
+
+++ mutt-1.6.1-trash/mutt.h 2016-06-12 18:43:04.912517922 +0100
494
+
@@ -182,6 +182,8 @@
503
+
@@ -719,6 +721,8 @@
504
+
unsigned int mime : 1; /* has a MIME-Version header? */
505
+
unsigned int flagged : 1; /* marked important? */
506
+
unsigned int tagged : 1;
507
+
+ unsigned int appended : 1; /* has been saved */
508
+
+ unsigned int purged : 1; /* bypassing the trash folder */
509
+
unsigned int deleted : 1;
510
+
unsigned int changed : 1;
511
+
unsigned int attach_del : 1; /* has an attachment marked for deletion */
512
+
@@ -891,6 +895,7 @@
513
+
int new; /* how many new messages? */
514
+
int unread; /* how many unread messages? */
515
+
int deleted; /* how many deleted messages */
516
+
+ int appended; /* how many saved messages? */
517
+
int flagged; /* how many flagged messages */
518
+
int msgnotreadyet; /* which msg "new" in pager, -1 if none */
520
+
diff -urN mutt-1.6.1/muttlib.c mutt-1.6.1-trash/muttlib.c
521
+
--- mutt-1.6.1/muttlib.c 2016-06-12 18:43:00.411447731 +0100
522
+
+++ mutt-1.6.1-trash/muttlib.c 2016-06-12 18:43:04.913517937 +0100
523
+
@@ -1511,7 +1511,9 @@
525
+
if (magic > 0 && !mx_access (s, W_OK))
527
+
- if (option (OPTCONFIRMAPPEND))
528
+
+ if (option (OPTCONFIRMAPPEND) &&
529
+
+ (!TrashPath || (mutt_strcmp (s, TrashPath) != 0)))
530
+
+ /* if we're appending to the trash, there's no point in asking */
532
+
snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s);
533
+
if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
534
+
diff -urN mutt-1.6.1/mx.c mutt-1.6.1-trash/mx.c
535
+
--- mutt-1.6.1/mx.c 2016-06-12 18:43:00.411447731 +0100
536
+
+++ mutt-1.6.1-trash/mx.c 2016-06-12 18:43:04.914517953 +0100
537
+
@@ -776,6 +776,62 @@
542
+
+ * trash_append - XXX
544
+
+ * move deleted mails to the trash folder
546
+
+static int trash_append (CONTEXT *ctx)
548
+
+ CONTEXT *ctx_trash;
550
+
+ struct stat st, stc;
552
+
+ if (!TrashPath || !ctx->deleted ||
553
+
+ ((ctx->magic == M_MAILDIR) && option (OPTMAILDIRTRASH))) {
557
+
+ for (; i < ctx->msgcount && (!ctx->hdrs[i]->deleted || ctx->hdrs[i]->appended); i++);
560
+
+ if (i == ctx->msgcount)
561
+
+ return 0; /* nothing to be done */
563
+
+ if (mutt_save_confirm (TrashPath, &st) != 0) {
564
+
+ mutt_error _("message(s) not deleted");
568
+
+ if (lstat (ctx->path, &stc) == 0 && stc.st_ino == st.st_ino
569
+
+ && stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev) {
570
+
+ return 0; /* we are in the trash folder: simple sync */
574
+
+ if (!imap_fast_trash())
578
+
+ if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL) {
579
+
+ for (i = 0 ; i < ctx->msgcount ; i++) {
580
+
+ if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
581
+
+ && !ctx->hdrs[i]->purged
582
+
+ && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1) {
583
+
+ mx_close_mailbox (ctx_trash, NULL);
588
+
+ mx_close_mailbox (ctx_trash, NULL);
590
+
+ mutt_error _("Can't open trash folder");
597
+
/* save changes and close mailbox */
598
+
int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
600
+
@@ -912,6 +968,7 @@
601
+
if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
603
+
mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1);
604
+
+ mutt_set_flag (ctx, ctx->hdrs[i], M_APPENDED, 1);
608
+
@@ -936,6 +993,14 @@
612
+
+ /* copy mails to the trash before expunging */
613
+
+ if (purge && ctx->deleted && mutt_strcmp (ctx->path, TrashPath)) {
614
+
+ if (trash_append (ctx) != 0) {
615
+
+ ctx->closing = 0;
621
+
/* allow IMAP to preserve the deleted flag across sessions */
622
+
if (ctx->magic == M_IMAP)
623
+
@@ -1140,6 +1205,12 @@
624
+
msgcount = ctx->msgcount;
625
+
deleted = ctx->deleted;
627
+
+ if (purge && ctx->deleted && mutt_strcmp (ctx->path, TrashPath)) {
628
+
+ if (trash_append (ctx) == -1) {
634
+
if (ctx->magic == M_IMAP)
635
+
rc = imap_sync_mailbox (ctx, purge, index_hint);
636
+
diff -urN mutt-1.6.1/OPS mutt-1.6.1-trash/OPS
637
+
--- mutt-1.6.1/OPS 2016-06-12 18:43:00.389447388 +0100
638
+
+++ mutt-1.6.1-trash/OPS 2016-06-12 18:43:04.883517469 +0100
639
+
@@ -142,6 +142,7 @@
640
+
OP_PREV_LINE "scroll up one line"
641
+
OP_PREV_PAGE "move to the previous page"
642
+
OP_PRINT "print the current entry"
643
+
+OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder"
644
+
OP_QUERY "query external program for addresses"
645
+
OP_QUERY_APPEND "append new query results to current results"
646
+
OP_QUIT "save changes to mailbox and quit"
647
+
diff -urN mutt-1.6.1/pager.c mutt-1.6.1-trash/pager.c
648
+
--- mutt-1.6.1/pager.c 2016-06-12 18:43:00.412447746 +0100
649
+
+++ mutt-1.6.1-trash/pager.c 2016-06-12 18:43:04.915517968 +0100
650
+
@@ -2351,6 +2351,7 @@
651
+
MAYBE_REDRAW (redraw);
654
+
+ case OP_PURGE_MESSAGE:
656
+
CHECK_MODE(IsHeader (extra));
658
+
@@ -2358,6 +2359,8 @@
659
+
CHECK_ACL(M_ACL_DELETE, _("Cannot delete message"));
661
+
mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
662
+
+ mutt_set_flag (Context, extra->hdr, M_PURGED,
663
+
+ ch != OP_PURGE_MESSAGE ? 0 : 1);
664
+
if (option (OPTDELETEUNTAG))
665
+
mutt_set_flag (Context, extra->hdr, M_TAG, 0);
666
+
redraw = REDRAW_STATUS | REDRAW_INDEX;
667
+
@@ -2688,6 +2691,7 @@
668
+
CHECK_ACL(M_ACL_DELETE, _("Cannot undelete message"));
670
+
mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
671
+
+ mutt_set_flag (Context, extra->hdr, M_PURGED, 0);
672
+
redraw = REDRAW_STATUS | REDRAW_INDEX;
673
+
if (option (OPTRESOLVE))
675
+
@@ -2704,9 +2708,11 @@
676
+
CHECK_ACL(M_ACL_DELETE, _("Cannot undelete message(s)"));
678
+
r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
679
+
+ ch == OP_UNDELETE_THREAD ? 0 : 1)
680
+
+ + mutt_thread_set_flag (extra->hdr, M_PURGED, 0,
681
+
ch == OP_UNDELETE_THREAD ? 0 : 1);
686
+
if (option (OPTRESOLVE))
688
+
diff -urN mutt-1.6.1/PATCHES mutt-1.6.1-trash/PATCHES
689
+
--- mutt-1.6.1/PATCHES 2016-06-12 18:43:00.395447481 +0100
690
+
+++ mutt-1.6.1-trash/PATCHES 2016-06-12 18:43:04.889517563 +0100
692
+
+patch-trash-neo-20160612
693
+
diff -urN mutt-1.6.1/pattern.c mutt-1.6.1-trash/pattern.c
694
+
--- mutt-1.6.1/pattern.c 2016-06-12 18:43:00.413447762 +0100
695
+
+++ mutt-1.6.1-trash/pattern.c 2016-06-12 18:43:04.916517984 +0100
696
+
@@ -1367,8 +1367,9 @@
702
+
+ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED, 0);
704
+
mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,
707
+
diff -urN mutt-1.6.1/postpone.c mutt-1.6.1-trash/postpone.c
708
+
--- mutt-1.6.1/postpone.c 2016-06-12 18:43:00.414447777 +0100
709
+
+++ mutt-1.6.1-trash/postpone.c 2016-06-12 18:43:04.917518000 +0100
710
+
@@ -277,6 +277,9 @@
711
+
/* finished with this message, so delete it. */
712
+
mutt_set_flag (PostContext, h, M_DELETE, 1);
714
+
+ /* and consider it saved, so that it won't be moved to the trash folder */
715
+
+ mutt_set_flag (PostContext, h, M_APPENDED, 1);
717
+
/* update the count for the status display */
718
+
PostCount = PostContext->msgcount - PostContext->deleted;
720
+
diff -urN mutt-1.6.1/README.trash mutt-1.6.1-trash/README.trash
721
+
--- mutt-1.6.1/README.trash 1970-01-01 01:00:00.000000000 +0100
722
+
+++ mutt-1.6.1-trash/README.trash 2016-06-12 18:43:04.748515364 +0100
724
+
+Trash Folder Patch
725
+
+==================
727
+
+ Automatically move "deleted" emails to a trash bin
732
+
+ To check if Mutt supports "Trash Folder", look for "patch-trash" in the
735
+
+ If IMAP is enabled, this patch will use it
744
+
+ In Mutt, when you "delete" an email it is first marked deleted. The email
745
+
+ isn't really gone until <sync-mailbox> is called. This happens when the
746
+
+ user leaves the folder, or the function is called manually.
748
+
+ After '<sync-mailbox>' has been called the email is gone forever.
750
+
+ The $trash variable defines a folder in which to keep old emails. As
751
+
+ before, first you mark emails for deletion. When <sync-mailbox> is called
752
+
+ the emails are moved to the trash folder.
754
+
+ The '$trash' path can be either a full directory, or be relative to the
755
+
+ $folder variable, like the 'mailboxes' command.
759
+
+ > Emails deleted from the trash folder are gone forever.
766
+
+ | Name | Type | Default |
767
+
+ |-------|--------|---------|
768
+
+ | trash | string | (none) |
775
+
+ | Menus | Default Key | Function | Description |
776
+
+ |-------------|-------------|-------------------|-------------------------------------------------------------|
777
+
+ | index,pager | (none) | '<purge-message>' | really delete the current entry, bypassing the trash folder |
782
+
+ * NeoMutt project
793
+
+ * Cedric Duval <cedricduval@free.fr>
794
+
+ * Benjamin Kuperman <kuperman@acm.org>
795
+
+ * Paul Miller <paul@voltar.org>
796
+
+ * Richard Russon <rich@flatcap.org>