flags: add flags_mail_dir_file util

And some whitespace cleanup
This commit is contained in:
Dirk-Jan C. Binnema 2023-09-19 22:23:47 +03:00
parent 472f69beb2
commit ae87be6a48
1 changed files with 60 additions and 41 deletions

View File

@ -348,7 +348,7 @@ flags_from_expr(std::string_view expr,
* @param flags flags
* @param cat category
*
* @return filter flags
* @return filtered flags
*/
constexpr Flags
flags_filter(Flags flags, MessageFlagCategory cat)
@ -359,6 +359,25 @@ flags_filter(Flags flags, MessageFlagCategory cat)
return flags;
}
/**
* Filter out any flags which are _not_ Maildir / Mailfile flags
*
* @param flags flags
*
* @return filtered flags
*/
constexpr Flags
flags_mail_dir_file(Flags flags)
{
for (auto&& info : AllMessageFlagInfos)
if (info.category != MessageFlagCategory::Maildir &&
info.category != MessageFlagCategory::Mailfile)
flags &= ~info.flag;
return flags;
}
/**
* Return flags, where flags = new_flags but with unmutable_flag in the