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 --- trash.orig/OPS 2006-12-12 14:15:02.000000000 +0100
32 +++ trash/OPS 2007-02-15 19:39:57.479112576 +0100
33 @@ -140,6 +140,7 @@ OP_PREV_ENTRY "move to the previous entr
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: trash/curs_main.c
42 ===================================================================
43 --- trash.orig/curs_main.c 2006-12-12 14:15:02.000000000 +0100
44 +++ trash/curs_main.c 2007-02-15 19:39:57.480112424 +0100
45 @@ -1778,6 +1778,7 @@ int mutt_index_menu (void)
46 MAYBE_REDRAW (menu->redraw);
49 + case OP_PURGE_MESSAGE:
53 @@ -1788,6 +1789,7 @@ int mutt_index_menu (void)
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;
61 @@ -1795,6 +1797,8 @@ int mutt_index_menu (void)
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 @@ -2088,11 +2092,13 @@ int mutt_index_menu (void)
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 @@ -2113,9 +2119,11 @@ int mutt_index_menu (void)
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 --- trash.orig/flags.c 2007-02-15 19:38:00.433906152 +0100
101 +++ trash/flags.c 2007-02-15 19:39:57.480112424 +0100
102 @@ -105,6 +105,16 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
112 + else if (h->purged)
118 if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
119 Index: trash/functions.h
120 ===================================================================
121 --- trash.orig/functions.h 2005-09-18 13:16:40.000000000 +0200
122 +++ trash/functions.h 2007-02-15 19:39:57.481112272 +0100
123 @@ -103,6 +103,7 @@ struct binding_t OpMain[] = {
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" },
131 @@ -189,6 +190,7 @@ struct binding_t OpPager[] = {
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 --- trash.orig/mutt.h 2007-02-15 19:38:00.435905848 +0100
142 +++ trash/mutt.h 2007-02-15 19:40:38.768835584 +0100
143 @@ -201,6 +201,7 @@ enum
151 @@ -705,6 +706,7 @@ typedef struct header
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 --- trash.orig/mx.c 2007-02-15 19:38:00.436905696 +0100
162 +++ trash/mx.c 2007-02-15 19:39:57.482112120 +0100
163 @@ -852,6 +852,7 @@ static int trash_append (CONTEXT *ctx)
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 --- trash.orig/pager.c 2006-12-12 14:15:03.000000000 +0100
174 +++ trash/pager.c 2007-02-15 19:39:57.482112120 +0100
175 @@ -2254,12 +2254,15 @@ search_next:
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 @@ -2572,6 +2575,7 @@ search_next:
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 @@ -2587,9 +2591,11 @@ search_next:
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: trash/pattern.c
213 ===================================================================
214 --- trash.orig/pattern.c 2007-01-25 21:44:41.000000000 +0100
215 +++ trash/pattern.c 2007-02-15 19:39:57.483111968 +0100
216 @@ -1338,8 +1338,10 @@ int mutt_pattern_func (int op, char *pro
222 + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
225 mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,
231 +patch-1.5.13.cd.purge_message.3.4