From: David Champion Date: Wed, 16 Nov 2016 23:43:50 +0000 (-0800) Subject: When $flag_safe is set, flagged messages cannot be deleted. X-Git-Tag: mutt-1-8-rel~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fde1e8fdb1653424f8c25032d6a9f3717c39cdcc;p=mutt When $flag_safe is set, flagged messages cannot be deleted. This saves them from bulk operations on threads and tagged messages. To remove a flagged message, first unflag it. --- diff --git a/flags.c b/flags.c index 3e802513..e47950dc 100644 --- a/flags.c +++ b/flags.c @@ -45,7 +45,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) if (bf) { - if (!h->deleted && !ctx->readonly) + if (!h->deleted && !ctx->readonly + && (!h->flagged || !option(OPTFLAGSAFE))) { h->deleted = 1; update = 1; diff --git a/init.h b/init.h index a0a399c1..9a37194e 100644 --- a/init.h +++ b/init.h @@ -799,6 +799,11 @@ struct option_t MuttVars[] = { ** signed. ** (PGP only) */ + { "flag_safe", DT_BOOL, R_NONE, OPTFLAGSAFE, 0 }, + /* + ** .pp + ** If set, flagged messages cannot be deleted. + */ { "folder", DT_PATH, R_NONE, UL &Maildir, UL "~/Mail" }, /* ** .pp diff --git a/mh.c b/mh.c index 41493f91..a96d09c1 100644 --- a/mh.c +++ b/mh.c @@ -696,8 +696,11 @@ static void maildir_parse_flags (HEADER * h, const char *path) break; case 'T': /* trashed */ - h->trash = 1; - h->deleted = 1; + if (!h->flagged || !option(OPTFLAGSAFE)) + { + h->trash = 1; + h->deleted = 1; + } break; default: diff --git a/mutt.h b/mutt.h index 98b77ffa..98660dae 100644 --- a/mutt.h +++ b/mutt.h @@ -352,6 +352,7 @@ enum OPTENVFROM, OPTFASTREPLY, OPTFCCCLEAR, + OPTFLAGSAFE, OPTFOLLOWUPTO, OPTFORCENAME, OPTFORWDECODE,