2 This is the purge message patch by Cedric Duval <cedricduval@free.fr>.
4 (requires trash folder patch)
6 This patch adds the purge-message function, which, unlike delete-message, will
7 bypass the trash folder and really delete the mail.
9 You can bind this function to <esc>D, for instance, by adding the following
12 bind index \eD purge-message
13 bind pager \eD purge-message
15 Please be very careful with this function, and try to use it as less as
16 possible. The risk resides in getting into the habit of always using
17 purge-message instead of delete-message, which would really defeat the purpose
18 of having a trash folder feature.
20 * Patch last synced with upstream:
22 - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.purge_message.3.4
26 - Fixed indentation of "purged" in mutt.h.
30 ===================================================================
31 --- mutt.orig/OPS 2009-06-25 12:35:37.000000000 +0200
32 +++ mutt/OPS 2009-06-25 12:36:14.000000000 +0200
34 OP_PREV_LINE "scroll up one line"
35 OP_PREV_PAGE "move to the previous page"
36 OP_PRINT "print the current entry"
37 +OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder"
38 OP_QUERY "query external program for addresses"
39 OP_QUERY_APPEND "append new query results to current results"
40 OP_QUIT "save changes to mailbox and quit"
41 Index: mutt/curs_main.c
42 ===================================================================
43 --- mutt.orig/curs_main.c 2009-06-25 12:35:44.000000000 +0200
44 +++ mutt/curs_main.c 2009-06-25 12:36:14.000000000 +0200
46 MAYBE_REDRAW (menu->redraw);
49 + case OP_PURGE_MESSAGE:
56 mutt_tag_set_flag (M_DELETE, 1);
57 + mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
58 if (option (OPTDELETEUNTAG))
59 mutt_tag_set_flag (M_TAG, 0);
60 menu->redraw = REDRAW_INDEX;
64 mutt_set_flag (Context, CURHDR, M_DELETE, 1);
65 + mutt_set_flag (Context, CURHDR, M_PURGED,
66 + (op != OP_PURGE_MESSAGE) ? 0 : 1);
67 if (option (OPTDELETEUNTAG))
68 mutt_set_flag (Context, CURHDR, M_TAG, 0);
69 if (option (OPTRESOLVE))
70 @@ -2136,11 +2140,13 @@
73 mutt_tag_set_flag (M_DELETE, 0);
74 + mutt_tag_set_flag (M_PURGED, 0);
75 menu->redraw = REDRAW_INDEX;
79 mutt_set_flag (Context, CURHDR, M_DELETE, 0);
80 + mutt_set_flag (Context, CURHDR, M_PURGED, 0);
81 if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)
84 @@ -2161,9 +2167,11 @@
85 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
87 rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
88 - op == OP_UNDELETE_THREAD ? 0 : 1);
89 + op == OP_UNDELETE_THREAD ? 0 : 1)
90 + + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
91 + op == OP_UNDELETE_THREAD ? 0 : 1);
96 if (option (OPTRESOLVE))
99 ===================================================================
100 --- mutt.orig/flags.c 2009-06-25 12:35:48.000000000 +0200
101 +++ mutt/flags.c 2009-06-25 12:36:14.000000000 +0200
112 + else if (h->purged)
118 if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
119 Index: mutt/functions.h
120 ===================================================================
121 --- mutt.orig/functions.h 2009-06-25 12:35:37.000000000 +0200
122 +++ mutt/functions.h 2009-06-25 12:36:14.000000000 +0200
124 { "toggle-write", OP_TOGGLE_WRITE, "%" },
125 { "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
126 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
127 + { "purge-message", OP_PURGE_MESSAGE, NULL },
128 { "query", OP_QUERY, "Q" },
129 { "quit", OP_QUIT, "q" },
130 { "reply", OP_REPLY, "r" },
132 { "print-message", OP_PRINT, "p" },
133 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
134 { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
135 + { "purge-message", OP_PURGE_MESSAGE, NULL },
136 { "quit", OP_QUIT, "Q" },
137 { "exit", OP_EXIT, "q" },
138 { "reply", OP_REPLY, "r" },
140 ===================================================================
141 --- mutt.orig/mutt.h 2009-06-25 12:35:48.000000000 +0200
142 +++ mutt/mutt.h 2009-06-25 12:36:14.000000000 +0200
152 unsigned int flagged : 1; /* marked important? */
153 unsigned int tagged : 1;
154 unsigned int appended : 1; /* has been saved */
155 + unsigned int purged : 1; /* bypassing the trash folder */
156 unsigned int deleted : 1;
157 unsigned int changed : 1;
158 unsigned int attach_del : 1; /* has an attachment marked for deletion */
160 ===================================================================
161 --- mutt.orig/mx.c 2009-06-25 12:36:10.000000000 +0200
162 +++ mutt/mx.c 2009-06-25 12:36:14.000000000 +0200
165 for (i = 0 ; i < ctx->msgcount ; i++)
166 if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
167 + && !ctx->hdrs[i]->purged
168 && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
170 mx_close_mailbox (ctx_trash, NULL);
172 ===================================================================
173 --- mutt.orig/pager.c 2009-06-25 12:35:44.000000000 +0200
174 +++ mutt/pager.c 2009-06-25 12:36:14.000000000 +0200
175 @@ -2316,12 +2316,15 @@
176 MAYBE_REDRAW (redraw);
179 + case OP_PURGE_MESSAGE:
181 CHECK_MODE(IsHeader (extra));
183 CHECK_ACL(M_ACL_DELETE, _("delete message"));
185 mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
186 + mutt_set_flag (Context, extra->hdr, M_PURGED,
187 + ch != OP_PURGE_MESSAGE ? 0 : 1);
188 if (option (OPTDELETEUNTAG))
189 mutt_set_flag (Context, extra->hdr, M_TAG, 0);
190 redraw = REDRAW_STATUS | REDRAW_INDEX;
191 @@ -2648,6 +2651,7 @@
192 CHECK_ACL(M_ACL_DELETE, _("undelete message"));
194 mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
195 + mutt_set_flag (Context, extra->hdr, M_PURGED, 0);
196 redraw = REDRAW_STATUS | REDRAW_INDEX;
197 if (option (OPTRESOLVE))
199 @@ -2663,9 +2667,11 @@
200 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
202 r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
203 + ch == OP_UNDELETE_THREAD ? 0 : 1)
204 + + mutt_thread_set_flag (extra->hdr, M_PURGED, 0,
205 ch == OP_UNDELETE_THREAD ? 0 : 1);
210 if (option (OPTRESOLVE))
212 Index: mutt/pattern.c
213 ===================================================================
214 --- mutt.orig/pattern.c 2009-06-25 12:35:37.000000000 +0200
215 +++ mutt/pattern.c 2009-06-25 12:36:14.000000000 +0200
216 @@ -1347,8 +1347,10 @@
222 + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
225 mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,