diff options
-rw-r--r-- | flags.c | 22 | ||||
-rw-r--r-- | init.h | 8 | ||||
-rw-r--r-- | mh.c | 14 | ||||
-rw-r--r-- | mutt.h | 1 |
4 files changed, 41 insertions, 4 deletions
@@ -38,6 +38,17 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) if (!h->deleted) { h->deleted = 1; + if (ctx->magic == M_MAILDIR && option(OPTMAILDIRTRASH)) + { + /* As with the IMAP comment below, we need to mark the + * message and mailbox as changed, because deleting a message + * just changes its status on disk without actually deleting + * it. Without this, the 'T' flag would never get set when + * the maildir box is synched. + */ + h->changed = 1; + if (upd_ctx) ctx->changed = 1; + } if (upd_ctx) ctx->deleted++; #ifdef USE_IMAP /* deleted messages aren't treated as changed elsewhere so that the @@ -54,6 +65,17 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) { h->deleted = 0; if (upd_ctx) ctx->deleted--; + if (ctx->magic == M_MAILDIR && option(OPTMAILDIRTRASH)) + { + /* As with the IMAP comment below, we need to mark the + * message and mailbox as changed, because deleting a message + * just changes its status on disk without actually deleting + * it. Without this, the 'T' flag would never get set when + * the maildir box is synched. + */ + h->changed = 1; + if (upd_ctx) ctx->changed = 1; + } #ifdef USE_IMAP /* see my comment above */ if (ctx->magic == M_IMAP) @@ -859,6 +859,14 @@ struct option_t MuttVars[] = { ** \fBDON'T CHANGE THIS SETTING UNLESS YOU ARE REALLY SURE WHAT YOU ARE ** DOING!\fP */ + { "maildir_trash", DT_BOOL, R_NONE, OPTMAILDIRTRASH, 0 }, + /* + ** .pp + ** If set, messages marked as deleted will be saved with the maildir + ** (T)rashed flag instead of unlinked. \fBNOTE:\fP this only applies + ** to maildir-style mailboxes. Setting it will have no effect on other + ** mailbox types. + */ { "mark_old", DT_BOOL, R_BOTH, OPTMARKOLD, 1 }, /* ** .pp @@ -105,6 +105,11 @@ static void maildir_parse_flags(HEADER *h, const char *path) h->replied = 1; break; + + case 'T': /* trashed */ + + h->deleted = 1; + break; } p++; } @@ -377,13 +382,14 @@ static void maildir_flags (char *dest, size_t destlen, HEADER *hdr) { *dest = '\0'; - if (hdr && (hdr->flagged || hdr->replied || hdr->read)) + if (hdr && (hdr->flagged || hdr->replied || hdr->read || hdr->deleted)) { snprintf (dest, destlen, - ":2,%s%s%s", + ":2,%s%s%s%s", hdr->flagged ? "F" : "", hdr->replied ? "R" : "", - hdr->read ? "S" : ""); + hdr->read ? "S" : "", + hdr->deleted ? "T" : ""); } } @@ -736,7 +742,7 @@ int mh_sync_mailbox (CONTEXT * ctx, int *index_hint) for (i = 0; i < ctx->msgcount; i++) { - if (ctx->hdrs[i]->deleted) + if (ctx->hdrs[i]->deleted && (ctx->magic != M_MAILDIR || !option(OPTMAILDIRTRASH))) { snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path); if (ctx->magic == M_MAILDIR || (option (OPTMHPURGE) && ctx->magic == M_MH)) @@ -331,6 +331,7 @@ enum #endif OPTIMPLICITAUTOVIEW, OPTMAILCAPSANITIZE, + OPTMAILDIRTRASH, OPTMARKERS, OPTMARKOLD, OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ |