Brian Bray <[EMAIL PROTECTED]> wrote:
>
> just wondering about the easiest way to go about makeing deleted mail
> transfer to a"trash" folder before for later retrival/deletion.
I have been using this patch to get a trash-folder effect; unfortunately
I have lost the author's name.
It was created for Mutt 0.94.3, but seems to work very well with 0.95,
since it is not very obtrusive.
--
David DeSimone | "The doctrine of human equality reposes on this:
[EMAIL PROTECTED] | that there is no man really clever who has not
Hewlett-Packard | found that he is stupid." -- Gilbert K. Chesterson
Convex Division | PGP: 5B 47 34 9F 3B 9A B0 0D AB A6 15 F1 BB BE 8C 44
diff -u mutt-0.94.3i/Muttrc.in mutt-0.94.3i-trash/Muttrc.in
--- mutt-0.94.3i/Muttrc.in Fri Jun 26 06:31:19 1998
+++ mutt-0.94.3i-trash/Muttrc.in Sun Aug 23 22:02:42 1998
@@ -144,6 +144,7 @@
# set timeout=600
# set tmpdir=""
# set to_chars="+TCF"
+# set trash=""
# unset use_8bitmime
# set use_domain
# set use_from
Common subdirectories: mutt-0.94.3i/doc and mutt-0.94.3i-trash/doc
diff -u mutt-0.94.3i/globals.h mutt-0.94.3i-trash/globals.h
--- mutt-0.94.3i/globals.h Fri Jul 17 03:47:13 1998
+++ mutt-0.94.3i-trash/globals.h Sun Aug 23 22:02:42 1998
@@ -77,6 +77,7 @@
WHERE char *Status;
WHERE char *Tempdir;
WHERE char *Tochars;
+WHERE char *Trash;
WHERE char *Username;
WHERE char *Visual;
diff -u mutt-0.94.3i/init.h mutt-0.94.3i-trash/init.h
--- mutt-0.94.3i/init.h Mon Aug 10 11:28:31 1998
+++ mutt-0.94.3i-trash/init.h Sun Aug 23 22:02:42 1998
@@ -255,6 +255,7 @@
{ "timeout", DT_NUM, R_NONE, UL &Timeout, 600 },
{ "tmpdir", DT_PATH, R_NONE, UL &Tempdir, 0 },
{ "to_chars", DT_STR, R_BOTH, UL &Tochars, UL " +TCF" },
+ { "trash", DT_PATH, R_NONE, UL &Trash, UL "" },
{ "use_8bitmime", DT_BOOL, R_NONE, OPTUSE8BITMIME, 0 },
{ "use_domain", DT_BOOL, R_NONE, OPTUSEDOMAIN, 1 },
{ "use_from", DT_BOOL, R_NONE, OPTUSEFROM, 1 },
diff -u mutt-0.94.3i/mx.c mutt-0.94.3i-trash/mx.c
--- mutt-0.94.3i/mx.c Tue Jul 28 04:16:01 1998
+++ mutt-0.94.3i-trash/mx.c Sun Aug 23 22:02:42 1998
@@ -23,7 +23,7 @@
#include "mailbox.h"
#include "copy.h"
#include "keymap.h"
-
+#include "globals.h"
#ifdef _PGPPATH
#include "pgp.h"
@@ -666,9 +666,41 @@
BUFFY *tmp = NULL;
#endif
int rc = -1;
+ int i, nosave = 0;
+ CONTEXT trash;
+ struct stat st;
+ char tmp[_POSIX_PATH_MAX+20];
if (!ctx->quiet)
mutt_message ("Writing %s...", ctx->path);
+
+ /* Only save messages to trash if there are deleted messages,
+ the Trash variable has been set,
+ and the current folder isn't the trash. */
+ if (ctx->deleted && strlen(Trash) && strncmp(ctx->path, Trash, _POSIX_PATH_MAX)) {
+ errno = 0;
+ stat(Trash, &st);
+ if (errno == ENOENT && option (OPTCONFIRMCREATE)) {
+ snprintf (tmp, sizeof (tmp), "Create trash mailbox, %s?", Trash);
+ if (mutt_yesorno (tmp, 1) < 1) {
+ if (mutt_yesorno("Purge deleted messages without saving?",1) < 1)
+ return (-1);
+ else
+ nosave = 1;
+ }
+ }
+ if (!nosave) {
+ if (mx_open_mailbox (Trash, M_APPEND | M_QUIET, &trash) == NULL) {
+ dprint (1, (debugfile, "sync_mailbox(): unable to open mailbox %s in
+append-mode, aborting.\n", Trash));
+ return (-1);
+ }
+ for (i = 0; i < ctx->msgcount; i++)
+ if (ctx->hdrs[i]->deleted)
+ mutt_append_message(&trash, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN);
+ mx_close_mailbox(&trash);
+ }
+ }
+
switch (ctx->magic)
{
case M_MBOX:
Common subdirectories: mutt-0.94.3i/rx and mutt-0.94.3i-trash/rx