From: Thomas Roessler Date: Tue, 22 Sep 1998 17:50:26 +0000 (+0000) Subject: Introduce the $mh_purge option. X-Git-Tag: mutt-0-94-8i-rel~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=940f31f67ffe4ec651c099c9bcd62b78d1189cc9;p=mutt Introduce the $mh_purge option. --- diff --git a/init.h b/init.h index 178a0178..02c7acf9 100644 --- a/init.h +++ b/init.h @@ -144,6 +144,7 @@ struct option_t MuttVars[] = { { "metoo", DT_BOOL, R_NONE, OPTMETOO, 0 }, { "menu_scroll", DT_BOOL, R_NONE, OPTMENUSCROLL, 0 }, { "meta_key", DT_BOOL, R_NONE, OPTMETAKEY, 0 }, + { "mh_purge", DT_BOOL, R_NONE, OPTMHPURGE, 0 }, { "mime_forward", DT_QUAD, R_NONE, OPT_MIMEFWD, 0 }, { "mime_forward_decode", DT_BOOL, R_NONE, OPTMIMEFORWDECODE, 0 }, { "mime_fwd", DT_SYN, R_NONE, UL "mime_forward", 0 }, diff --git a/mh.c b/mh.c index 3ea7f158..b8a90132 100644 --- a/mh.c +++ b/mh.c @@ -131,7 +131,7 @@ void mh_parse_message (CONTEXT *ctx, /* * Mark all the mails in ctx read. */ -void tag_all_read (CONTEXT * ctx) +static void tag_all_read (CONTEXT * ctx) { int i; @@ -148,7 +148,7 @@ void tag_all_read (CONTEXT * ctx) /* * Mark one mail as unread */ -int tag_unread (CONTEXT * ctx, char *name) +static int tag_unread (CONTEXT * ctx, char *name) { int i; @@ -621,14 +621,18 @@ int mh_sync_mailbox (CONTEXT * ctx) if (ctx->hdrs[i]->deleted) { snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path); - if (ctx->magic == M_MAILDIR) + if (ctx->magic == M_MAILDIR || (option (OPTMHPURGE) && ctx->magic == M_MH)) unlink (path); - else + else if (ctx->magic == M_MH) { /* MH just moves files out of the way when you delete them */ - snprintf (tmp, sizeof (tmp), "%s/,%s", ctx->path, ctx->hdrs[i]->path); - unlink (tmp); - rename (path, tmp); + if(*ctx->hdrs[i]->path != ',') + { + snprintf (tmp, sizeof (tmp), "%s/,%s", ctx->path, ctx->hdrs[i]->path); + unlink (tmp); + rename (path, tmp); + } + } } else if (ctx->hdrs[i]->changed || ctx->hdrs[i]->attach_del) diff --git a/mutt.h b/mutt.h index bc89caf8..9f3d647c 100644 --- a/mutt.h +++ b/mutt.h @@ -270,6 +270,7 @@ enum OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ OPTMETAKEY, /* interpret ALT-x as ESC-x */ OPTMETOO, + OPTMHPURGE, OPTMIMEFORWDECODE, OPTPAGERSTOP, OPTPIPEDECODE,