]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-cd.purge_message.patch
- rel 3
[packages/mutt.git] / mutt-cd.purge_message.patch
1 # vim:ft=diff:
2 This is the purge message patch by Cedric Duval <cedricduval@free.fr>.
3
4 (requires trash folder patch)
5
6 This patch adds the purge-message function, which, unlike delete-message, will
7 bypass the trash folder and really delete the mail.
8
9 You can bind this function to <esc>D, for instance, by adding the following
10 lines to your muttrc:
11
12 bind index \eD purge-message
13 bind pager \eD purge-message
14
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.
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"
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"
39 --- a/curs_main.c
40 +++ b/curs_main.c
41 @@ -1843,6 +1843,7 @@
42         MAYBE_REDRAW (menu->redraw);
43         break;
44  
45 +      case OP_PURGE_MESSAGE:
46        case OP_DELETE:
47  
48         CHECK_MSGCOUNT;
49 @@ -1853,6 +1854,7 @@
50         if (tag)
51         {
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;
57 @@ -1860,6 +1862,8 @@
58         else
59         {
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 @@ -2161,11 +2165,13 @@
67         if (tag)
68         {
69           mutt_tag_set_flag (M_DELETE, 0);
70 +         mutt_tag_set_flag (M_PURGED, 0);
71           menu->redraw = REDRAW_INDEX;
72         }
73         else
74         {
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)
78           {
79             menu->current++;
80 @@ -2186,9 +2192,11 @@
81         CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
82  
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         {
92           if (option (OPTRESOLVE))
93           {
94 --- a/flags.c
95 +++ b/flags.c
96 @@ -104,6 +104,16 @@
97        }
98        break;
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:
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" },
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" },
123 @@ -213,6 +214,7 @@
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" },
131 --- a/mutt.h
132 +++ b/mutt.h
133 @@ -188,6 +188,7 @@
134    M_UNDELETE,
135    M_DELETED,
136    M_APPENDED,
137 +  M_PURGED,
138    M_FLAG,
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 */
146    unsigned int deleted : 1;
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++)
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)
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;
164  
165 +      case OP_PURGE_MESSAGE:
166        case OP_DELETE:
167         CHECK_MODE(IsHeader (extra));
168         CHECK_READONLY;
169         CHECK_ACL(M_ACL_DELETE, _("delete message"));
170  
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 @@ -2675,6 +2678,7 @@
178         CHECK_ACL(M_ACL_DELETE, _("undelete message"));
179  
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))
184         {
185 @@ -2690,9 +2694,11 @@
186         CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
187  
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         {
196           if (option (OPTRESOLVE))
197           {
198 --- a/pattern.c
199 +++ b/pattern.c
200 @@ -1357,8 +1357,10 @@
201        {
202         switch (op)
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, 
210                           (op == M_DELETE));
211             break;
This page took 0.055084 seconds and 3 git commands to generate.