]>
Commit | Line | Data |
---|---|---|
68eeb855 | 1 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/PATCHES mutt-1.5.10/PATCHES |
2 | --- mutt-1.5.10.orig/PATCHES 2005-10-07 09:29:54.000000000 +0200 | |
3 | +++ mutt-1.5.10/PATCHES 2005-10-07 09:30:06.000000000 +0200 | |
4 | @@ -1,2 +1,3 @@ | |
5 | vvv.quote | |
6 | +patch-1.3.27.cd.trash_folder.1 | |
7 | rr.compressed | |
8 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/commands.c mutt-1.5.10/commands.c | |
9 | --- mutt-1.5.10.orig/commands.c 2005-08-02 09:08:00.000000000 +0200 | |
10 | +++ mutt-1.5.10/commands.c 2005-10-07 09:32:06.000000000 +0200 | |
11 | @@ -690,6 +690,7 @@ | |
12 | if (option (OPTDELETEUNTAG)) | |
13 | mutt_set_flag (Context, h, M_TAG, 0); | |
3b22acf6 | 14 | } |
68eeb855 | 15 | + mutt_set_flag (Context, h, M_APPENDED, 1); |
16 | ||
17 | return 0; | |
3b22acf6 | 18 | } |
68eeb855 | 19 | Only in mutt-1.5.10/doc: manual-1.html |
20 | Only in mutt-1.5.10/doc: manual-2.html | |
21 | Only in mutt-1.5.10/doc: manual-3.html | |
22 | Only in mutt-1.5.10/doc: manual-4.html | |
23 | Only in mutt-1.5.10/doc: manual-5.html | |
24 | Only in mutt-1.5.10/doc: manual-6.html | |
25 | Only in mutt-1.5.10/doc: manual-7.html | |
26 | Only in mutt-1.5.10/doc: manual.html | |
27 | Only in mutt-1.5.10/doc: manual.txt | |
28 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/flags.c mutt-1.5.10/flags.c | |
29 | --- mutt-1.5.10.orig/flags.c 2005-02-03 19:47:52.000000000 +0100 | |
30 | +++ mutt-1.5.10/flags.c 2005-10-07 09:30:06.000000000 +0200 | |
31 | @@ -91,6 +91,17 @@ | |
32 | } | |
3b22acf6 | 33 | break; |
34 | ||
35 | + case M_APPENDED: | |
36 | + if (bf) | |
37 | + { | |
38 | + if (!h->appended) | |
39 | + { | |
40 | + h->appended = 1; | |
41 | + if (upd_ctx) ctx->appended++; | |
42 | + } | |
43 | + } | |
44 | + break; | |
45 | + | |
46 | case M_NEW: | |
68eeb855 | 47 | |
48 | #ifdef USE_IMAP | |
49 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/globals.h mutt-1.5.10/globals.h | |
50 | --- mutt-1.5.10.orig/globals.h 2005-10-07 09:29:54.000000000 +0200 | |
51 | +++ mutt-1.5.10/globals.h 2005-10-07 09:30:06.000000000 +0200 | |
52 | @@ -130,6 +130,7 @@ | |
53 | WHERE char *Status; | |
3b22acf6 | 54 | WHERE char *Tempdir; |
55 | WHERE char *Tochars; | |
56 | +WHERE char *TrashPath; | |
57 | WHERE char *Username; | |
58 | WHERE char *Visual; | |
68eeb855 | 59 | |
60 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/init.h mutt-1.5.10/init.h | |
61 | --- mutt-1.5.10.orig/init.h 2005-10-07 09:29:54.000000000 +0200 | |
62 | +++ mutt-1.5.10/init.h 2005-10-07 09:30:06.000000000 +0200 | |
63 | @@ -2774,6 +2774,13 @@ | |
64 | ** by \fIyou\fP. The sixth character is used to indicate when a mail | |
3b22acf6 | 65 | ** was sent to a mailing-list you subscribe to (default: L). |
66 | */ | |
67 | + { "trash", DT_PATH, R_NONE, UL &TrashPath, 0 }, | |
68 | + /* | |
69 | + ** .pp | |
70 | + ** If set, this variable specifies the path of the trash folder where the | |
71 | + ** mails marked for deletion will be moved, instead of being irremediably | |
72 | + ** purged. | |
73 | + */ | |
74 | #ifdef USE_SOCKET | |
75 | { "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 }, | |
68eeb855 | 76 | /* |
77 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/mutt.h mutt-1.5.10/mutt.h | |
78 | --- mutt-1.5.10.orig/mutt.h 2005-10-07 09:29:54.000000000 +0200 | |
79 | +++ mutt-1.5.10/mutt.h 2005-10-07 09:30:06.000000000 +0200 | |
80 | @@ -207,6 +207,7 @@ | |
81 | M_DELETE, | |
3b22acf6 | 82 | M_UNDELETE, |
83 | M_DELETED, | |
84 | + M_APPENDED, | |
85 | M_FLAG, | |
86 | M_TAG, | |
68eeb855 | 87 | M_UNTAG, |
88 | @@ -702,6 +703,7 @@ | |
89 | unsigned int mime : 1; /* has a Mime-Version header? */ | |
3b22acf6 | 90 | unsigned int flagged : 1; /* marked important? */ |
91 | unsigned int tagged : 1; | |
92 | + unsigned int appended : 1; /* has been saved */ | |
93 | unsigned int deleted : 1; | |
94 | unsigned int changed : 1; | |
68eeb855 | 95 | unsigned int attach_del : 1; /* has an attachment marked for deletion */ |
96 | @@ -830,6 +832,7 @@ | |
97 | int new; /* how many new messages? */ | |
3b22acf6 | 98 | int unread; /* how many unread messages? */ |
99 | int deleted; /* how many deleted messages */ | |
100 | + int appended; /* how many saved messages? */ | |
101 | int flagged; /* how many flagged messages */ | |
102 | int msgnotreadyet; /* which msg "new" in pager, -1 if none */ | |
68eeb855 | 103 | #if defined USE_POP || defined USE_IMAP |
104 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/mx.c mutt-1.5.10/mx.c | |
105 | --- mutt-1.5.10.orig/mx.c 2005-10-07 09:29:54.000000000 +0200 | |
106 | +++ mutt-1.5.10/mx.c 2005-10-07 09:30:06.000000000 +0200 | |
107 | @@ -850,6 +850,47 @@ | |
108 | return rc; | |
3b22acf6 | 109 | } |
110 | ||
111 | +/* move deleted mails to the trash folder */ | |
112 | +static int trash_append (CONTEXT *ctx) | |
113 | +{ | |
114 | + CONTEXT *ctx_trash; | |
115 | + int i; | |
116 | + struct stat st, stc; | |
117 | + | |
118 | + if (!TrashPath || !ctx->deleted) | |
119 | + return 0; | |
120 | + | |
121 | + if (!mutt_save_confirm (TrashPath, &st)) | |
122 | + { | |
123 | + mutt_error _("message(s) not deleted"); | |
124 | + return -1; | |
125 | + } | |
126 | + | |
127 | + if (lstat (ctx->path, &stc) == 0 && stc.st_ino == st.st_ino | |
128 | + && stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev) | |
129 | + return 0; /* we are in the trash folder: simple sync */ | |
130 | + | |
131 | + if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL) | |
132 | + { | |
133 | + for (i = 0 ; i < ctx->msgcount ; i++) | |
134 | + if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended | |
135 | + && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1) | |
136 | + { | |
137 | + mx_close_mailbox (ctx_trash, NULL); | |
138 | + return -1; | |
139 | + } | |
140 | + | |
141 | + mx_close_mailbox (ctx_trash, NULL); | |
142 | + } | |
143 | + else | |
144 | + { | |
145 | + mutt_error _("Can't open trash folder"); | |
146 | + return -1; | |
147 | + } | |
148 | + | |
149 | + return 0; | |
150 | +} | |
151 | + | |
152 | /* save changes and close mailbox */ | |
153 | int mx_close_mailbox (CONTEXT *ctx, int *index_hint) | |
68eeb855 | 154 | { |
155 | @@ -1032,11 +1073,19 @@ | |
156 | ||
3b22acf6 | 157 | if (ctx->changed || ctx->deleted) |
158 | { | |
159 | - if ((check = sync_mailbox (ctx, index_hint)) != 0) | |
160 | + int trsh = 0; | |
161 | + | |
162 | + if ((!ctx->deleted || (trsh = trash_append (ctx)) == 0) | |
163 | + && (check = sync_mailbox (ctx, index_hint)) != 0) | |
164 | { | |
165 | ctx->closing = 0; | |
166 | return check; | |
167 | } | |
168 | + if (trsh != 0) | |
169 | + { | |
170 | + ctx->closing = 0; | |
171 | + return -1; | |
172 | + } | |
173 | } | |
174 | } | |
68eeb855 | 175 | |
176 | @@ -1214,8 +1263,12 @@ | |
177 | if (ctx->magic == M_IMAP) | |
3b22acf6 | 178 | rc = imap_sync_mailbox (ctx, purge, index_hint); |
179 | else | |
180 | -#endif | |
181 | +#endif /* enter this block unconditionally if IMAP is not used */ | |
182 | + { | |
183 | + if (trash_append (ctx) == -1) | |
184 | + return -1; | |
185 | rc = sync_mailbox (ctx, index_hint); | |
186 | + } | |
187 | if (rc == 0) | |
188 | { | |
68eeb855 | 189 | #ifdef USE_IMAP |
190 | diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/postpone.c mutt-1.5.10/postpone.c | |
191 | --- mutt-1.5.10.orig/postpone.c 2005-02-03 19:47:53.000000000 +0100 | |
192 | +++ mutt-1.5.10/postpone.c 2005-10-07 09:30:06.000000000 +0200 | |
193 | @@ -279,6 +279,9 @@ | |
194 | /* finished with this message, so delete it. */ | |
3b22acf6 | 195 | mutt_set_flag (PostContext, h, M_DELETE, 1); |
196 | ||
197 | + /* and consider it saved, so that it won't be moved to the trash folder */ | |
198 | + mutt_set_flag (PostContext, h, M_APPENDED, 1); | |
199 | + | |
200 | /* update the count for the status display */ | |
201 | PostCount = PostContext->msgcount - PostContext->deleted; | |
68eeb855 | 202 |