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.
32 OP_PREV_LINE "scroll up one line"
33 OP_PREV_PAGE "move to the previous page"
34 OP_PRINT "print the current entry"
35 +OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder"
36 OP_QUERY "query external program for addresses"
37 OP_QUERY_APPEND "append new query results to current results"
38 OP_QUIT "save changes to mailbox and quit"
42 MAYBE_REDRAW (menu->redraw);
45 + case OP_PURGE_MESSAGE:
52 mutt_tag_set_flag (M_DELETE, 1);
53 + mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
54 if (option (OPTDELETEUNTAG))
55 mutt_tag_set_flag (M_TAG, 0);
56 menu->redraw = REDRAW_INDEX;
60 mutt_set_flag (Context, CURHDR, M_DELETE, 1);
61 + mutt_set_flag (Context, CURHDR, M_PURGED,
62 + (op != OP_PURGE_MESSAGE) ? 0 : 1);
63 if (option (OPTDELETEUNTAG))
64 mutt_set_flag (Context, CURHDR, M_TAG, 0);
65 if (option (OPTRESOLVE))
66 @@ -2129,11 +2133,13 @@
69 mutt_tag_set_flag (M_DELETE, 0);
70 + mutt_tag_set_flag (M_PURGED, 0);
71 menu->redraw = REDRAW_INDEX;
75 mutt_set_flag (Context, CURHDR, M_DELETE, 0);
76 + mutt_set_flag (Context, CURHDR, M_PURGED, 0);
77 if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)
80 @@ -2154,9 +2160,11 @@
81 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
83 rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
84 - op == OP_UNDELETE_THREAD ? 0 : 1);
85 + op == OP_UNDELETE_THREAD ? 0 : 1)
86 + + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
87 + op == OP_UNDELETE_THREAD ? 0 : 1);
92 if (option (OPTRESOLVE))
106 + else if (h->purged)
112 if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
116 { "toggle-write", OP_TOGGLE_WRITE, "%" },
117 { "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
118 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
119 + { "purge-message", OP_PURGE_MESSAGE, NULL },
120 { "query", OP_QUERY, "Q" },
121 { "quit", OP_QUIT, "q" },
122 { "reply", OP_REPLY, "r" },
124 { "print-message", OP_PRINT, "p" },
125 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
126 { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
127 + { "purge-message", OP_PURGE_MESSAGE, NULL },
128 { "quit", OP_QUIT, "Q" },
129 { "exit", OP_EXIT, "q" },
130 { "reply", OP_REPLY, "r" },
142 unsigned int flagged : 1; /* marked important? */
143 unsigned int tagged : 1;
144 unsigned int appended : 1; /* has been saved */
145 + unsigned int purged : 1; /* bypassing the trash folder */
146 unsigned int deleted : 1;
147 unsigned int changed : 1;
148 unsigned int attach_del : 1; /* has an attachment marked for deletion */
153 for (i = 0 ; i < ctx->msgcount ; i++)
154 if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
155 + && !ctx->hdrs[i]->purged
156 && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
158 mx_close_mailbox (ctx_trash, NULL);
161 @@ -2272,12 +2272,15 @@
162 MAYBE_REDRAW (redraw);
165 + case OP_PURGE_MESSAGE:
167 CHECK_MODE(IsHeader (extra));
169 CHECK_ACL(M_ACL_DELETE, _("delete message"));
171 mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
172 + mutt_set_flag (Context, extra->hdr, M_PURGED,
173 + ch != OP_PURGE_MESSAGE ? 0 : 1);
174 if (option (OPTDELETEUNTAG))
175 mutt_set_flag (Context, extra->hdr, M_TAG, 0);
176 redraw = REDRAW_STATUS | REDRAW_INDEX;
177 @@ -2590,6 +2593,7 @@
178 CHECK_ACL(M_ACL_DELETE, _("undelete message"));
180 mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
181 + mutt_set_flag (Context, extra->hdr, M_PURGED, 0);
182 redraw = REDRAW_STATUS | REDRAW_INDEX;
183 if (option (OPTRESOLVE))
185 @@ -2605,9 +2609,11 @@
186 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
188 r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
189 + ch == OP_UNDELETE_THREAD ? 0 : 1)
190 + + mutt_thread_set_flag (extra->hdr, M_PURGED, 0,
191 ch == OP_UNDELETE_THREAD ? 0 : 1);
196 if (option (OPTRESOLVE))
200 @@ -1344,8 +1344,10 @@
206 + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
209 mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,