{
char fn[128], fmt[128];
struct Folder *folder = (struct Folder *) data;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
mutt_format_s(buf, buflen, prec, "");
}
else if (folder->ff->msg_count == 0)
- optional = 0;
+ optional = false;
break;
case 'N':
mutt_format_s(buf, buflen, prec, "");
}
else if (folder->ff->msg_unread == 0)
- optional = 0;
+ optional = false;
break;
case 's':
unsigned long data, MuttFormatFlags flags)
{
char fmt[128], tmp[128];
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
struct Menu *menu = (struct Menu *) data;
*buf = '\0';
struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data;
char fmt[128], tmp[1024];
char *p = NULL, *tags = NULL;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
int threads = ((C_Sort & SORT_MASK) == SORT_THREADS);
int is_index = (flags & MUTT_FORMAT_INDEX);
size_t colorlen;
if (op == 'K')
{
if (optional)
- optional = 0;
+ optional = false;
/* break if 'K' returns nothing */
break;
}
j *= -1;
if (((now > j) || (now < (-1 * j))) ^ invert)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, mutt_messages_in_thread(m, e, 0));
}
else if (mutt_messages_in_thread(m, e, 0) <= 1)
- optional = 0;
+ optional = false;
break;
case 'f':
}
else if (mutt_addr_is_user(from))
{
- optional = 0;
+ optional = false;
}
break;
add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
}
else if (!tags)
- optional = 0;
+ optional = false;
FREE(&tags);
break;
{
tags = driver_tags_get_transformed_for(&e->tags, tag);
if (!tags)
- optional = 0;
+ optional = false;
FREE(&tags);
}
}
case 'H':
/* (Hormel) spam score */
if (optional)
- optional = e->env->spam ? 1 : 0;
+ optional = e->env->spam;
if (e->env->spam)
mutt_format_s(buf, buflen, prec, NONULL(e->env->spam->data));
add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
}
else if (e->lines <= 0)
- optional = 0;
+ optional = false;
break;
case 'L':
else if (!check_for_mailing_list(&e->env->to, NULL, NULL, 0) &&
!check_for_mailing_list(&e->env->cc, NULL, NULL, 0))
{
- optional = 0;
+ optional = false;
}
break;
else
{
if (!(threads && is_index && e->collapsed && (e->num_hidden > 1)))
- optional = 0;
+ optional = false;
}
break;
else
{
if (e->score == 0)
- optional = 0;
+ optional = false;
}
break;
else if (!check_for_mailing_list_addr(&e->env->to, NULL, 0) &&
!check_for_mailing_list_addr(&e->env->cc, NULL, 0))
{
- optional = 0;
+ optional = false;
}
break;
tmp[0] = '\0';
mutt_addrlist_write(tmp, sizeof(tmp), &e->env->to, true);
if (optional && (tmp[0] == '\0'))
- optional = 0;
+ optional = false;
mutt_format_s(buf, buflen, prec, tmp);
break;
tmp[0] = '\0';
mutt_addrlist_write(tmp, sizeof(tmp), &e->env->cc, true);
if (optional && (tmp[0] == '\0'))
- optional = 0;
+ optional = false;
mutt_format_s(buf, buflen, prec, tmp);
break;
mutt_format_s(buf, buflen, prec, e->env->organization ? e->env->organization : "");
}
else if (!e->env->organization)
- optional = 0;
+ optional = false;
break;
#ifdef USE_NNTP
mutt_format_s(buf, buflen, prec, e->env->x_comment_to ? e->env->x_comment_to : "");
}
else if (!e->env->x_comment_to)
- optional = 0;
+ optional = false;
break;
#endif
/* The recursion allows messages without depth to return 0. */
if (optional)
- optional = count != 0;
+ optional = (count != 0);
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
snprintf(buf, buflen, fmt, count);
case 'y':
if (optional)
- optional = e->env->x_label ? 1 : 0;
+ optional = e->env->x_label;
colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_LABEL);
mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(e->env->x_label));
unsigned long data, MuttFormatFlags flags)
{
char fmt[128];
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
struct CryptEntry *entry = (struct CryptEntry *) data;
struct CryptKeyInfo *key = entry->key;
snprintf(buf, buflen, fmt, crypt_key_abilities(kflags));
}
else if (!(kflags & KEYFLAG_ABILITIES))
- optional = 0;
+ optional = false;
break;
case 'f':
snprintf(buf, buflen, fmt, crypt_flags(kflags));
}
else if (!(kflags & KEYFLAG_RESTRICTIONS))
- optional = 0;
+ optional = false;
break;
case 'k':
{
char fmt[128];
struct PgpCommandContext *cctx = (struct PgpCommandContext *) data;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
snprintf(buf, buflen, fmt, NONULL(cctx->signas));
}
else if (!cctx->signas)
- optional = 0;
+ optional = false;
break;
}
case 'f':
snprintf(buf, buflen, fmt, NONULL(cctx->fname));
}
else if (!cctx->fname)
- optional = 0;
+ optional = false;
break;
}
case 'p':
snprintf(buf, buflen, fmt, cctx->need_passphrase ? "PGPPASSFD=0" : "");
}
else if (!cctx->need_passphrase || pgp_use_gpg_agent())
- optional = 0;
+ optional = false;
break;
}
case 'r':
snprintf(buf, buflen, fmt, NONULL(cctx->ids));
}
else if (!cctx->ids)
- optional = 0;
+ optional = false;
break;
}
case 's':
snprintf(buf, buflen, fmt, NONULL(cctx->sig_fname));
}
else if (!cctx->sig_fname)
- optional = 0;
+ optional = false;
break;
}
default:
unsigned long data, MuttFormatFlags flags)
{
char fmt[128];
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
struct PgpEntry *entry = (struct PgpEntry *) data;
struct PgpUid *uid = entry->uid;
snprintf(buf, buflen, fmt, pgp_key_abilities(kflags));
}
else if (!(kflags & KEYFLAG_ABILITIES))
- optional = 0;
+ optional = false;
break;
case 'f':
if (!optional)
snprintf(buf, buflen, fmt, pgp_flags(kflags));
}
else if (!(kflags & KEYFLAG_RESTRICTIONS))
- optional = 0;
+ optional = false;
break;
case 'k':
if (!optional)
else if (!(uid->trust & 0x03))
{
/* undefined trust */
- optional = 0;
+ optional = false;
}
break;
case 'u':
{
char fmt[128];
struct SmimeCommandContext *cctx = (struct SmimeCommandContext *) data;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
mutt_buffer_pool_release(&buf2);
}
else if (!C_SmimeCaLocation)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->certificates));
}
else if (!cctx->certificates)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->intermediates));
}
else if (!cctx->intermediates)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->sig_fname));
}
else if (!cctx->sig_fname)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->key));
}
else if (!cctx->key)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->cryptalg));
}
else if (!cctx->key)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->fname));
}
else if (!cctx->fname)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, NONULL(cctx->digestalg));
}
else if (!cctx->key)
- optional = 0;
+ optional = false;
break;
}
struct Query *query = entry->data;
char fmt[128];
char tmp[256] = { 0 };
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
if (!optional)
mutt_format_s(buf, buflen, prec, NONULL(query->other));
else if (!query->other || !*query->other)
- optional = 0;
+ optional = false;
break;
case 'n':
mutt_format_s(buf, buflen, prec, NONULL(query->name));
char fmt[128];
char charset[128];
struct AttachPtr *aptr = (struct AttachPtr *) data;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
else if (!mutt_is_text_part(aptr->content) ||
!mutt_body_get_charset(aptr->content, charset, sizeof(charset)))
{
- optional = 0;
+ optional = false;
}
break;
case 'c':
((aptr->content->type != TYPE_TEXT) || aptr->content->noconv) ? 'n' : 'c');
}
else if ((aptr->content->type != TYPE_TEXT) || aptr->content->noconv)
- optional = 0;
+ optional = false;
break;
case 'd':
if (!optional)
}
else if (!aptr->content->d_filename && !aptr->content->filename)
{
- optional = 0;
+ optional = false;
break;
}
/* fallthrough */
mutt_format_s(buf, buflen, prec, NONULL(aptr->content->filename));
}
else if (!aptr->content->filename)
- optional = 0;
+ optional = false;
break;
case 'D':
if (!optional)
snprintf(buf, buflen, "%c", aptr->content->deleted ? 'D' : ' ');
else if (!aptr->content->deleted)
- optional = 0;
+ optional = false;
break;
case 'e':
if (!optional)
if (!optional)
mutt_format_s(buf, buflen, prec, aptr->content->subtype);
else if (!aptr->content->subtype)
- optional = 0;
+ optional = false;
break;
case 'n':
if (!optional)
mutt_format_s(buf, buflen, prec, tmp);
}
else if (l == 0)
- optional = 0;
+ optional = false;
break;
}
if (!optional)
snprintf(buf, buflen, "%c", aptr->content->tagged ? '*' : ' ');
else if (!aptr->content->tagged)
- optional = 0;
+ optional = false;
break;
case 'T':
if (!optional)
mutt_format_s_tree(buf, buflen, prec, NONULL(aptr->tree));
else if (!aptr->tree)
- optional = 0;
+ optional = false;
break;
case 'u':
if (!optional)
snprintf(buf, buflen, "%c", aptr->content->unlink ? '-' : ' ');
else if (!aptr->content->unlink)
- optional = 0;
+ optional = false;
break;
case 'X':
if (optional)
- optional = (aptr->content->attach_count + aptr->content->attach_qualifies) != 0;
+ optional = ((aptr->content->attach_count + aptr->content->attach_qualifies) != 0);
else
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
{
char fmt[128];
struct Remailer *remailer = (struct Remailer *) data;
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
snprintf(buf, buflen, fmt, NONULL(remailer->addr));
}
else if (!remailer->addr)
- optional = 0;
+ optional = false;
break;
case 'c':
snprintf(buf, buflen, fmt, NONULL(remailer->shortname));
}
else if (!remailer->shortname)
- optional = 0;
+ optional = false;
break;
default:
unsigned long data, MuttFormatFlags flags)
{
struct SbEntry *sbe = (struct SbEntry *) data;
- unsigned int optional;
char fmt[256];
if (!sbe || !buf)
bool c = Context && Context->mailbox &&
(mutt_str_strcmp(Context->mailbox->realpath, m->realpath) == 0);
- optional = flags & MUTT_FORMAT_OPTIONAL;
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
switch (op)
{
snprintf(buf, buflen, fmt, c ? Context->mailbox->msg_deleted : 0);
}
else if ((c && (Context->mailbox->msg_deleted == 0)) || !c)
- optional = 0;
+ optional = false;
break;
case 'D':
snprintf(buf, buflen, fmt, m->msg_flagged);
}
else if (m->msg_flagged == 0)
- optional = 0;
+ optional = false;
break;
case 'L':
snprintf(buf, buflen, fmt, c ? Context->mailbox->vcount : m->msg_count);
}
else if ((c && (Context->mailbox->vcount == m->msg_count)) || !c)
- optional = 0;
+ optional = false;
break;
case 'N':
snprintf(buf, buflen, fmt, m->msg_unread);
}
else if (m->msg_unread == 0)
- optional = 0;
+ optional = false;
break;
case 'n':
snprintf(buf, buflen, fmt, m->has_new ? 'N' : ' ');
}
else if (m->has_new == false)
- optional = 0;
+ optional = false;
break;
case 'S':
snprintf(buf, buflen, fmt, m->msg_count);
}
else if (m->msg_count == 0)
- optional = 0;
+ optional = false;
break;
case 't':
snprintf(buf, buflen, fmt, c ? Context->mailbox->msg_tagged : 0);
}
else if ((c && (Context->mailbox->msg_tagged == 0)) || !c)
- optional = 0;
+ optional = false;
break;
case '!':
unsigned long data, MuttFormatFlags flags)
{
char fmt[128], tmp[128];
- int optional = (flags & MUTT_FORMAT_OPTIONAL);
+ bool optional = (flags & MUTT_FORMAT_OPTIONAL);
struct Menu *menu = (struct Menu *) data;
*buf = '\0';
mutt_mailbox_check(Context ? Context->mailbox : NULL, 0));
}
else if (mutt_mailbox_check(Context ? Context->mailbox : NULL, 0) == 0)
- optional = 0;
+ optional = false;
break;
case 'd':
(Context && Context->mailbox) ? Context->mailbox->msg_deleted : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_deleted == 0))
- optional = 0;
+ optional = false;
break;
case 'D':
(Context && Context->mailbox) ? Context->mailbox->msg_flagged : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_flagged == 0))
- optional = 0;
+ optional = false;
break;
case 'h':
snprintf(buf, buflen, fmt, tmp);
}
else if (!Context || !Context->mailbox || !Context->mailbox->size)
- optional = 0;
+ optional = false;
break;
case 'L':
snprintf(buf, buflen, fmt, tmp);
}
else if (!Context || !Context->pattern)
- optional = 0;
+ optional = false;
break;
case 'm':
(Context && Context->mailbox) ? Context->mailbox->msg_count : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_count == 0))
- optional = 0;
+ optional = false;
break;
case 'M':
(Context && Context->mailbox) ? Context->mailbox->vcount : 0);
}
else if (!Context || !Context->pattern)
- optional = 0;
+ optional = false;
break;
case 'n':
(Context && Context->mailbox) ? Context->mailbox->msg_new : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_new == 0))
- optional = 0;
+ optional = false;
break;
case 'o':
}
else if (!Context || !Context->mailbox ||
((Context->mailbox->msg_unread - Context->mailbox->msg_new) == 0))
- optional = 0;
+ optional = false;
break;
case 'p':
snprintf(buf, buflen, fmt, count);
}
else if (count == 0)
- optional = 0;
+ optional = false;
break;
}
snprintf(buf, buflen, fmt, read);
}
else if (read == 0)
- optional = 0;
+ optional = false;
break;
}
(Context && Context->mailbox) ? Context->mailbox->msg_tagged : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_tagged == 0))
- optional = 0;
+ optional = false;
break;
case 'u':
(Context && Context->mailbox) ? Context->mailbox->msg_unread : 0);
}
else if (!Context || !Context->mailbox || (Context->mailbox->msg_unread == 0))
- optional = 0;
+ optional = false;
break;
case 'v':
snprintf(buf, buflen, fmt, (Context && Context->pattern) ? Context->pattern : "");
}
else if (!Context || !Context->pattern)
- optional = 0;
+ optional = false;
break;
case 0: