Ticket #13363: patch-1.5.17.cd.purge_message.bk.1

File patch-1.5.17.cd.purge_message.bk.1, 6.9 KB (added by kuperman@…, 17 years ago)

Purge patch (needs trash patch to already be applied)

Line 
1diff -pruN mutt-1.5.17/OPS mutt-1.5.17-purge/OPS
2--- mutt-1.5.17/OPS     2007-05-07 14:46:12.000000000 -0400
3+++ mutt-1.5.17-purge/OPS       2007-12-21 19:52:37.000000000 -0500
4@@ -141,6 +141,7 @@ OP_PREV_ENTRY "move to the previous entr
5 OP_PREV_LINE "scroll up one line"
6 OP_PREV_PAGE "move to the previous page"
7 OP_PRINT "print the current entry"
8+OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder"
9 OP_QUERY "query external program for addresses"
10 OP_QUERY_APPEND "append new query results to current results"
11 OP_QUIT "save changes to mailbox and quit"
12diff -pruN mutt-1.5.17/PATCHES mutt-1.5.17-purge/PATCHES
13--- mutt-1.5.17/PATCHES 2007-12-21 19:45:26.000000000 -0500
14+++ mutt-1.5.17-purge/PATCHES   2007-12-21 19:52:37.000000000 -0500
15@@ -1 +1,2 @@
16 patch-1.5.16hg.cd.trash_folder.vl.1
17+patch-1.5.17.cd.purge_message.bk.1
18diff -pruN mutt-1.5.17/curs_main.c mutt-1.5.17-purge/curs_main.c
19--- mutt-1.5.17/curs_main.c     2007-05-28 19:19:50.000000000 -0400
20+++ mutt-1.5.17-purge/curs_main.c       2007-12-21 19:52:37.000000000 -0500
21@@ -1799,6 +1799,7 @@ int mutt_index_menu (void)
22        MAYBE_REDRAW (menu->redraw);
23        break;
24 
25+      case OP_PURGE_MESSAGE:
26       case OP_DELETE:
27 
28        CHECK_MSGCOUNT;
29@@ -1809,6 +1810,7 @@ int mutt_index_menu (void)
30        if (tag)
31        {
32          mutt_tag_set_flag (M_DELETE, 1);
33+         mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
34          if (option (OPTDELETEUNTAG))
35            mutt_tag_set_flag (M_TAG, 0);
36          menu->redraw = REDRAW_INDEX;
37@@ -1816,6 +1818,8 @@ int mutt_index_menu (void)
38        else
39        {
40          mutt_set_flag (Context, CURHDR, M_DELETE, 1);
41+         mutt_set_flag (Context, CURHDR, M_PURGED,
42+                        (op != OP_PURGE_MESSAGE) ? 0 : 1);
43          if (option (OPTDELETEUNTAG))
44            mutt_set_flag (Context, CURHDR, M_TAG, 0);
45          if (option (OPTRESOLVE))
46@@ -2112,11 +2116,13 @@ int mutt_index_menu (void)
47        if (tag)
48        {
49          mutt_tag_set_flag (M_DELETE, 0);
50+         mutt_tag_set_flag (M_PURGED, 0);
51          menu->redraw = REDRAW_INDEX;
52        }
53        else
54        {
55          mutt_set_flag (Context, CURHDR, M_DELETE, 0);
56+         mutt_set_flag (Context, CURHDR, M_PURGED, 0);
57          if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)
58          {
59            menu->current++;
60@@ -2137,9 +2143,11 @@ int mutt_index_menu (void)
61        CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
62 
63        rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
64-                                  op == OP_UNDELETE_THREAD ? 0 : 1);
65+                                  op == OP_UNDELETE_THREAD ? 0 : 1)
66+         + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
67+                                 op == OP_UNDELETE_THREAD ? 0 : 1);
68 
69-       if (rc != -1)
70+       if (rc > -1)
71        {
72          if (option (OPTRESOLVE))
73          {
74diff -pruN mutt-1.5.17/flags.c mutt-1.5.17-purge/flags.c
75--- mutt-1.5.17/flags.c 2007-12-21 19:45:26.000000000 -0500
76+++ mutt-1.5.17-purge/flags.c   2007-12-21 19:52:37.000000000 -0500
77@@ -108,6 +108,16 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
78       }
79       break;
80 
81+    case M_PURGED:
82+      if (bf)
83+      {
84+       if (!h->purged)
85+         h->purged = 1;
86+      }
87+      else if (h->purged)
88+       h->purged = 0;
89+      break;
90+
91     case M_NEW:
92 
93       if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
94diff -pruN mutt-1.5.17/functions.h mutt-1.5.17-purge/functions.h
95--- mutt-1.5.17/functions.h     2007-05-07 14:45:34.000000000 -0400
96+++ mutt-1.5.17-purge/functions.h       2007-12-21 19:52:37.000000000 -0500
97@@ -120,6 +120,7 @@ struct binding_t OpMain[] = { /* map: in
98   { "toggle-write",            OP_TOGGLE_WRITE,                "%" },
99   { "next-thread",             OP_MAIN_NEXT_THREAD,            "\016" },
100   { "next-subthread",          OP_MAIN_NEXT_SUBTHREAD,         "\033n" },
101+  { "purge-message",           OP_PURGE_MESSAGE,               NULL },
102   { "query",                   OP_QUERY,                       "Q" },
103   { "quit",                    OP_QUIT,                        "q" },
104   { "reply",                   OP_REPLY,                       "r" },
105@@ -207,6 +208,7 @@ struct binding_t OpPager[] = { /* map: p
106   { "print-message",   OP_PRINT,                       "p" },
107   { "previous-thread", OP_MAIN_PREV_THREAD,            "\020" },
108   { "previous-subthread",OP_MAIN_PREV_SUBTHREAD,       "\033p" },
109+  { "purge-message",   OP_PURGE_MESSAGE,               NULL },
110   { "quit",            OP_QUIT,                        "Q" },
111   { "exit",            OP_EXIT,                        "q" },
112   { "reply",           OP_REPLY,                       "r" },
113diff -pruN mutt-1.5.17/mutt.h mutt-1.5.17-purge/mutt.h
114--- mutt-1.5.17/mutt.h  2007-12-21 19:45:26.000000000 -0500
115+++ mutt-1.5.17-purge/mutt.h    2007-12-21 19:52:37.000000000 -0500
116@@ -202,6 +202,7 @@ enum
117   M_UNDELETE,
118   M_DELETED,
119   M_APPENDED,
120+  M_PURGED,
121   M_FLAG,
122   M_TAG,
123   M_UNTAG,
124@@ -713,6 +714,7 @@ typedef struct header
125   unsigned int flagged : 1;            /* marked important? */
126   unsigned int tagged : 1;
127   unsigned int appended : 1; /* has been saved */
128+  unsigned int purged : 1;   /* bypassing the trash folder */
129   unsigned int deleted : 1;
130   unsigned int changed : 1;
131   unsigned int attach_del : 1;                 /* has an attachment marked for deletion */
132diff -pruN mutt-1.5.17/mx.c mutt-1.5.17-purge/mx.c
133--- mutt-1.5.17/mx.c    2007-12-21 19:45:26.000000000 -0500
134+++ mutt-1.5.17-purge/mx.c      2007-12-21 19:53:07.000000000 -0500
135@@ -833,6 +833,7 @@ static int trash_append (CONTEXT *ctx)
136     {
137       for (i = 0 ; i < ctx->msgcount ; i++)
138        if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
139+           && !ctx->hdrs[i]->purged
140            && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
141          {
142            mx_close_mailbox (ctx_trash, NULL);
143diff -pruN mutt-1.5.17/pager.c mutt-1.5.17-purge/pager.c
144--- mutt-1.5.17/pager.c 2007-09-05 14:28:05.000000000 -0400
145+++ mutt-1.5.17-purge/pager.c   2007-12-21 19:52:37.000000000 -0500
146@@ -2256,12 +2256,15 @@ search_next:
147        MAYBE_REDRAW (redraw);
148        break;
149 
150+      case OP_PURGE_MESSAGE:
151       case OP_DELETE:
152        CHECK_MODE(IsHeader (extra));
153        CHECK_READONLY;
154        CHECK_ACL(M_ACL_DELETE, _("delete message"));
155 
156        mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
157+       mutt_set_flag (Context, extra->hdr, M_PURGED,
158+                      ch != OP_PURGE_MESSAGE ? 0 : 1);
159         if (option (OPTDELETEUNTAG))
160          mutt_set_flag (Context, extra->hdr, M_TAG, 0);
161        redraw = REDRAW_STATUS | REDRAW_INDEX;
162@@ -2574,6 +2577,7 @@ search_next:
163        CHECK_ACL(M_ACL_DELETE, _("undelete message"));
164 
165        mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
166+       mutt_set_flag (Context, extra->hdr, M_PURGED, 0);
167        redraw = REDRAW_STATUS | REDRAW_INDEX;
168        if (option (OPTRESOLVE))
169        {
170@@ -2589,9 +2593,11 @@ search_next:
171        CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
172 
173        r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
174+                                 ch == OP_UNDELETE_THREAD ? 0 : 1)
175+         + mutt_thread_set_flag (extra->hdr, M_PURGED, 0,
176                                  ch == OP_UNDELETE_THREAD ? 0 : 1);
177 
178-       if (r != -1)
179+       if (r > -1)
180        {
181          if (option (OPTRESOLVE))
182          {
183diff -pruN mutt-1.5.17/pattern.c mutt-1.5.17-purge/pattern.c
184--- mutt-1.5.17/pattern.c       2007-09-05 14:28:05.000000000 -0400
185+++ mutt-1.5.17-purge/pattern.c 2007-12-21 19:52:37.000000000 -0500
186@@ -1344,8 +1344,10 @@ int mutt_pattern_func (int op, char *pro
187       {
188        switch (op)
189        {
190-         case M_DELETE:
191          case M_UNDELETE:
192+           mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
193+                          0);
194+         case M_DELETE:
195            mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,
196                          (op == M_DELETE));
197            break;