]> git.pld-linux.org Git - packages/mutt.git/blame - mutt-cd.purge_message.patch
- release 11 (by relup.sh)
[packages/mutt.git] / mutt-cd.purge_message.patch
CommitLineData
ebc5806e
JR
1# vim:ft=diff:
2This is the purge message patch by Cedric Duval <cedricduval@free.fr>.
3
4(requires trash folder patch)
5
6This patch adds the purge-message function, which, unlike delete-message, will
7bypass the trash folder and really delete the mail.
8
9You can bind this function to <esc>D, for instance, by adding the following
10lines to your muttrc:
11
12bind index \eD purge-message
13bind pager \eD purge-message
14
15Please be very careful with this function, and try to use it as less as
16possible. The risk resides in getting into the habit of always using
17purge-message instead of delete-message, which would really defeat the purpose
18of having a trash folder feature.
19
20* Patch last synced with upstream:
21 - Date: 2007-02-15
22 - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.purge_message.3.4
23
24* Changes made:
25 - Updated to 1.5.13
26 - Fixed indentation of "purged" in mutt.h.
27
28== END PATCH
29--- a/OPS
30+++ b/OPS
31@@ -142,6 +142,7 @@
32 OP_PREV_LINE "scroll up one line"
33 OP_PREV_PAGE "move to the previous page"
d66e5ee8 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"
ebc5806e
JR
37 OP_QUERY_APPEND "append new query results to current results"
38 OP_QUIT "save changes to mailbox and quit"
39--- a/curs_main.c
40+++ b/curs_main.c
41@@ -1843,6 +1843,7 @@
42 MAYBE_REDRAW (menu->redraw);
43 break;
d66e5ee8 44
45+ case OP_PURGE_MESSAGE:
46 case OP_DELETE:
ebc5806e
JR
47
48 CHECK_MSGCOUNT;
49@@ -1853,6 +1854,7 @@
50 if (tag)
51 {
d66e5ee8 52 mutt_tag_set_flag (M_DELETE, 1);
ebc5806e 53+ mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
d66e5ee8 54 if (option (OPTDELETEUNTAG))
ebc5806e
JR
55 mutt_tag_set_flag (M_TAG, 0);
56 menu->redraw = REDRAW_INDEX;
57@@ -1860,6 +1862,8 @@
58 else
59 {
d66e5ee8 60 mutt_set_flag (Context, CURHDR, M_DELETE, 1);
ebc5806e
JR
61+ mutt_set_flag (Context, CURHDR, M_PURGED,
62+ (op != OP_PURGE_MESSAGE) ? 0 : 1);
d66e5ee8 63 if (option (OPTDELETEUNTAG))
ebc5806e
JR
64 mutt_set_flag (Context, CURHDR, M_TAG, 0);
65 if (option (OPTRESOLVE))
66@@ -2161,11 +2165,13 @@
67 if (tag)
68 {
d66e5ee8 69 mutt_tag_set_flag (M_DELETE, 0);
70+ mutt_tag_set_flag (M_PURGED, 0);
71 menu->redraw = REDRAW_INDEX;
ebc5806e
JR
72 }
73 else
74 {
d66e5ee8 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)
ebc5806e
JR
78 {
79 menu->current++;
80@@ -2186,9 +2192,11 @@
81 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
82
d66e5ee8 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);
88
89- if (rc != -1)
90+ if (rc > -1)
91 {
ebc5806e
JR
92 if (option (OPTRESOLVE))
93 {
94--- a/flags.c
95+++ b/flags.c
96@@ -104,6 +104,16 @@
97 }
98 break;
d66e5ee8 99
100+ case M_PURGED:
101+ if (bf)
102+ {
103+ if (!h->purged)
104+ h->purged = 1;
105+ }
106+ else if (h->purged)
107+ h->purged = 0;
108+ break;
109+
110 case M_NEW:
ebc5806e
JR
111
112 if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
113--- a/functions.h
114+++ b/functions.h
115@@ -121,6 +121,7 @@
116 { "toggle-write", OP_TOGGLE_WRITE, "%" },
117 { "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
d66e5ee8 118 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
119+ { "purge-message", OP_PURGE_MESSAGE, NULL },
120 { "query", OP_QUERY, "Q" },
ebc5806e
JR
121 { "quit", OP_QUIT, "q" },
122 { "reply", OP_REPLY, "r" },
123@@ -213,6 +214,7 @@
124 { "print-message", OP_PRINT, "p" },
125 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
d66e5ee8 126 { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
127+ { "purge-message", OP_PURGE_MESSAGE, NULL },
128 { "quit", OP_QUIT, "Q" },
ebc5806e
JR
129 { "exit", OP_EXIT, "q" },
130 { "reply", OP_REPLY, "r" },
131--- a/mutt.h
132+++ b/mutt.h
133@@ -188,6 +188,7 @@
134 M_UNDELETE,
135 M_DELETED,
d66e5ee8 136 M_APPENDED,
137+ M_PURGED,
138 M_FLAG,
ebc5806e
JR
139 M_TAG,
140 M_UNTAG,
141@@ -709,6 +710,7 @@
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 */
d66e5ee8 146 unsigned int deleted : 1;
ebc5806e
JR
147 unsigned int changed : 1;
148 unsigned int attach_del : 1; /* has an attachment marked for deletion */
149--- a/mx.c
150+++ b/mx.c
151@@ -806,6 +806,7 @@
152 {
153 for (i = 0 ; i < ctx->msgcount ; i++)
d66e5ee8 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)
ebc5806e
JR
157 {
158 mx_close_mailbox (ctx_trash, NULL);
159--- a/pager.c
160+++ b/pager.c
161@@ -2343,12 +2343,15 @@
162 MAYBE_REDRAW (redraw);
163 break;
d66e5ee8 164
165+ case OP_PURGE_MESSAGE:
166 case OP_DELETE:
ebc5806e
JR
167 CHECK_MODE(IsHeader (extra));
168 CHECK_READONLY;
169 CHECK_ACL(M_ACL_DELETE, _("delete message"));
170
d66e5ee8 171 mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
ebc5806e
JR
172+ mutt_set_flag (Context, extra->hdr, M_PURGED,
173+ ch != OP_PURGE_MESSAGE ? 0 : 1);
d66e5ee8 174 if (option (OPTDELETEUNTAG))
ebc5806e
JR
175 mutt_set_flag (Context, extra->hdr, M_TAG, 0);
176 redraw = REDRAW_STATUS | REDRAW_INDEX;
177@@ -2675,6 +2678,7 @@
178 CHECK_ACL(M_ACL_DELETE, _("undelete message"));
179
d66e5ee8 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;
ebc5806e
JR
183 if (option (OPTRESOLVE))
184 {
185@@ -2690,9 +2694,11 @@
186 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
187
d66e5ee8 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);
192
193- if (r != -1)
194+ if (r > -1)
195 {
ebc5806e
JR
196 if (option (OPTRESOLVE))
197 {
198--- a/pattern.c
199+++ b/pattern.c
200@@ -1357,8 +1357,10 @@
201 {
202 switch (op)
d66e5ee8 203 {
204- case M_DELETE:
205 case M_UNDELETE:
206+ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
207+ 0);
208+ case M_DELETE:
209 mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,
ebc5806e
JR
210 (op == M_DELETE));
211 break;
This page took 0.061136 seconds and 4 git commands to generate.