int flags;
int op = OP_NULL;
bool done = false; /* controls when to exit the "event" loop */
- bool tag = false; /* has the tag-prefix command been pressed? */
+ bool tag = false; /* has the tag-prefix command been pressed? */
int newcount = -1;
int oldcount = -1;
- int index_hint; /* used to restore cursor position */
+ int index_hint; /* used to restore cursor position */
bool do_mailbox_notify = true;
int close = 0; /* did we OP_QUIT or OP_EXIT out of this menu? */
int attach_msg = OptAttachMsg;
/* Clear the tag prefix unless we just started it. Don't clear
* the prefix on a timeout (op==-2), but do clear on an abort (op==-1)
*/
- if (tag && op != OP_TAG_PREFIX && op != OP_TAG_PREFIX_COND && op != -2)
+ if (tag && (op != OP_TAG_PREFIX) && (op != OP_TAG_PREFIX_COND) && (op != -2))
tag = false;
/* check if we need to resort the index because just about
* any 'op' below could do mutt_enter_command(), either here or
* from any new menu launched, and change $sort/$sort_aux
*/
- if (OptNeedResort && Context && Context->mailbox->msg_count && menu->current >= 0)
+ if (OptNeedResort && Context && (Context->mailbox->msg_count != 0) &&
+ (menu->current >= 0))
resort_index(menu);
menu->max = Context ? Context->mailbox->vcount : 0;
oldcount = Context ? Context->mailbox->msg_count : 0;
- if (OptRedrawTree && Context && Context->mailbox->msg_count && (Sort & SORT_MASK) == SORT_THREADS)
+ if (OptRedrawTree && Context && (Context->mailbox->msg_count != 0) &&
+ ((Sort & SORT_MASK) == SORT_THREADS))
{
mutt_draw_tree(Context);
menu->redraw |= REDRAW_STATUS;
* modified underneath us.)
*/
- index_hint = (Context->mailbox->vcount && menu->current >= 0 &&
- menu->current < Context->mailbox->vcount) ?
+ index_hint = ((Context->mailbox->vcount != 0) && (menu->current >= 0) &&
+ (menu->current < Context->mailbox->vcount)) ?
CUR_EMAIL->index :
0;
check = mx_mbox_check(Context->mailbox, &index_hint);
if (check < 0)
{
- if (!Context->mailbox || Context->mailbox->path[0] == '\0')
+ if (!Context->mailbox || (Context->mailbox->path[0] == '\0'))
{
/* fatal error occurred */
ctx_free(&Context);
OptSearchInvalid = true;
}
- else if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED || check == MUTT_FLAGS)
+ else if ((check == MUTT_NEW_MAIL) || (check == MUTT_REOPENED) || (check == MUTT_FLAGS))
{
/* notify the user of new mail */
if (check == MUTT_REOPENED)
mutt_curs_set(1);
/* special handling for the tag-prefix function */
- if (op == OP_TAG_PREFIX || op == OP_TAG_PREFIX_COND)
+ if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
{
/* A second tag-prefix command aborts */
if (tag)
*/
case OP_MAIN_DELETE_PATTERN:
- if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY | CHECK_ATTACH))
+ if (!prereq(Context, menu,
+ CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY | CHECK_ATTACH))
+ {
break;
+ }
/* L10N: CHECK_ACL */
/* L10N: Due to the implementation details we do not know whether we
delete zero, 1, 12, ... messages. So in English we use
case OP_TOGGLE_READ:
if (!prereq(Context, menu, CHECK_IN_MAILBOX))
break;
- menu->oldcurrent = (Context->mailbox->vcount && menu->current >= 0 &&
- menu->current < Context->mailbox->vcount) ?
+ menu->oldcurrent = ((Context->mailbox->vcount != 0) && (menu->current >= 0) &&
+ (menu->current < Context->mailbox->vcount)) ?
CUR_EMAIL->index :
-1;
if (op == OP_TOGGLE_READ)
done = true;
else
{
- if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED)
+ if ((check == MUTT_NEW_MAIL) || (check == MUTT_REOPENED))
update_index(menu, Context, check, oldcount, index_hint);
menu->redraw = REDRAW_FULL; /* new mail arrived? */
{
mutt_set_flag(Context->mailbox, CUR_EMAIL, MUTT_TAG, !CUR_EMAIL->tagged);
- Context->last_tag = CUR_EMAIL->tagged ?
- CUR_EMAIL :
- ((Context->last_tag == CUR_EMAIL && !CUR_EMAIL->tagged) ?
- NULL :
- Context->last_tag);
+ Context->last_tag =
+ CUR_EMAIL->tagged ?
+ CUR_EMAIL :
+ (((Context->last_tag == CUR_EMAIL) && !CUR_EMAIL->tagged) ?
+ NULL :
+ Context->last_tag);
menu->redraw |= REDRAW_STATUS;
if (Resolve && menu->current < Context->mailbox->vcount - 1)
#ifdef USE_IMAP
case OP_MAIN_IMAP_FETCH:
- if (Context && Context->mailbox->magic == MUTT_IMAP)
+ if (Context && (Context->mailbox->magic == MUTT_IMAP))
imap_check_mailbox(Context->mailbox, true);
break;
case OP_MAIN_IMAP_LOGOUT_ALL:
- if (Context && Context->mailbox->magic == MUTT_IMAP)
+ if (Context && (Context->mailbox->magic == MUTT_IMAP))
{
int check = mx_mbox_close(&Context);
if (check != 0)
int check = mx_mbox_sync(Context->mailbox, &index_hint);
if (check == 0)
{
- if (e && Context->mailbox->vcount != ovc)
+ if (e && (Context->mailbox->vcount != ovc))
{
for (size_t i = 0; i < Context->mailbox->vcount; i++)
{
}
OptSearchInvalid = true;
}
- else if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED)
+ else if ((check == MUTT_NEW_MAIL) || (check == MUTT_REOPENED))
update_index(menu, Context, check, oc, index_hint);
/* do a sanity check even if mx_mbox_sync failed. */
#endif
if (attach_msg || ReadOnly ||
#ifdef USE_NNTP
- op == OP_MAIN_CHANGE_GROUP_READONLY ||
+ (op == OP_MAIN_CHANGE_GROUP_READONLY) ||
#endif
- op == OP_MAIN_CHANGE_FOLDER_READONLY)
+ (op == OP_MAIN_CHANGE_FOLDER_READONLY))
+ {
flags = MUTT_READONLY;
+ }
else
flags = 0;
mutt_pretty_mailbox(buf, sizeof(buf));
}
#ifdef USE_NNTP
- if (op == OP_MAIN_CHANGE_GROUP || op == OP_MAIN_CHANGE_GROUP_READONLY)
+ if ((op == OP_MAIN_CHANGE_GROUP) || (op == OP_MAIN_CHANGE_GROUP_READONLY))
{
OptNews = true;
m = Context ? Context->mailbox : NULL;
OptNeedResort = false;
- if ((Sort & SORT_MASK) == SORT_THREADS && CUR_EMAIL->collapsed)
+ if (((Sort & SORT_MASK) == SORT_THREADS) && CUR_EMAIL->collapsed)
{
mutt_uncollapse_thread(Context, CUR_EMAIL);
mutt_set_virtual(Context);
case OP_EXIT:
close = op;
- if (menu->menu == MENU_MAIN && attach_msg)
+ if ((menu->menu == MENU_MAIN) && attach_msg)
{
done = true;
break;
case OP_MAIN_NEXT_UNDELETED:
if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
break;
- if (menu->current >= Context->mailbox->vcount - 1)
+ if (menu->current >= (Context->mailbox->vcount - 1))
{
if (menu->menu == MENU_MAIN)
mutt_message(_("You are on the last message"));
case OP_NEXT_ENTRY:
if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
break;
- if (menu->current >= Context->mailbox->vcount - 1)
+ if (menu->current >= (Context->mailbox->vcount - 1))
{
if (menu->menu == MENU_MAIN)
mutt_message(_("You are on the last message"));
menu->current = -1;
for (size_t i = 0; i != Context->mailbox->vcount; i++)
{
- if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_NEXT_NEW_THEN_UNREAD)
+ if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_NEXT_UNREAD) ||
+ (op == OP_MAIN_NEXT_NEW_THEN_UNREAD))
{
cur++;
- if (cur > Context->mailbox->vcount - 1)
+ if (cur > (Context->mailbox->vcount - 1))
{
cur = 0;
}
}
struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[cur]];
- if (e->collapsed && (Sort & SORT_MASK) == SORT_THREADS)
+ if (e->collapsed && ((Sort & SORT_MASK) == SORT_THREADS))
{
- if (UNREAD(e) && first_unread == -1)
+ if ((UNREAD(e) != 0) && (first_unread == -1))
first_unread = cur;
- if (UNREAD(e) == 1 && first_new == -1)
+ if ((UNREAD(e) == 1) && (first_new == -1))
first_new = cur;
}
- else if ((!e->deleted && !e->read))
+ else if (!e->deleted && !e->read)
{
if (first_unread == -1)
first_unread = cur;
- if ((!e->old) && first_new == -1)
+ if (!e->old && (first_new == -1))
first_new = cur;
}
- if ((op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD) && first_unread != -1)
+ if (((op == OP_MAIN_NEXT_UNREAD) || (op == OP_MAIN_PREV_UNREAD)) &&
+ (first_unread != -1))
break;
- if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW ||
- op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD) &&
- first_new != -1)
+ if (((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW) ||
+ (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
+ (first_new != -1))
{
break;
}
}
- if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW ||
- op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD) &&
- first_new != -1)
+ if (((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW) ||
+ (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
+ (first_new != -1))
{
menu->current = first_new;
}
- else if ((op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD ||
- op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD) &&
- first_unread != -1)
+ else if (((op == OP_MAIN_NEXT_UNREAD) || (op == OP_MAIN_PREV_UNREAD) ||
+ (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
+ (first_unread != -1))
{
menu->current = first_unread;
}
if (menu->current == -1)
{
menu->current = menu->oldcurrent;
- if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW)
+ if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW))
{
if (Context->pattern)
mutt_error(_("No new messages in this limited view"));
break;
}
- if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_NEXT_NEW_THEN_UNREAD)
+ if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_NEXT_UNREAD) ||
+ (op == OP_MAIN_NEXT_NEW_THEN_UNREAD))
{
if (saved_current > menu->current)
{
if (menu->current < 0)
{
menu->current = menu->oldcurrent;
- if (op == OP_MAIN_NEXT_THREAD || op == OP_MAIN_NEXT_SUBTHREAD)
+ if ((op == OP_MAIN_NEXT_THREAD) || (op == OP_MAIN_NEXT_SUBTHREAD))
mutt_error(_("No more threads"));
else
mutt_error(_("You are on the first thread"));
case OP_CATCHUP:
if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_READONLY | CHECK_ATTACH))
break;
- if (Context && Context->mailbox->magic == MUTT_NNTP)
+ if (Context && (Context->mailbox->magic == MUTT_NNTP))
{
struct NntpMboxData *mdata = Context->mailbox->mdata;
if (mutt_newsgroup_catchup(Context->mailbox, mdata->adata, mdata->group))
menu->redraw = REDRAW_FULL;
/* L10N: This is displayed when the x-label on one or more
* messages is edited. */
- mutt_message(ngettext("%d label changed", "%d labels changed", num_changed), num_changed);
+ mutt_message(ngettext("%d label changed", "%d labels changed", num_changed),
+ num_changed);
}
else
{
/* in an IMAP folder index with imap_peek=no, piping could change
* new or old messages status to read. Redraw what's needed.
*/
- if (Context->mailbox->magic == MUTT_IMAP && !ImapPeek)
+ if ((Context->mailbox->magic == MUTT_IMAP) && !ImapPeek)
{
menu->redraw |= (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS;
}
/* in an IMAP folder index with imap_peek=no, printing could change
* new or old messages status to read. Redraw what's needed.
*/
- if (Context->mailbox->magic == MUTT_IMAP && !ImapPeek)
+ if ((Context->mailbox->magic == MUTT_IMAP) && !ImapPeek)
{
menu->redraw |= (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS;
}
break;
int rc = mutt_thread_set_flag(CUR_EMAIL, MUTT_READ, 1,
- op == OP_MAIN_READ_THREAD ? 0 : 1);
+ (op == OP_MAIN_READ_THREAD) ? 0 : 1);
if (rc != -1)
{
if (Resolve)
case OP_POST:
if (!prereq(Context, menu, CHECK_ATTACH))
break;
- if (op != OP_FOLLOWUP || !CUR_EMAIL->env->followup_to ||
+ if ((op != OP_FOLLOWUP) || !CUR_EMAIL->env->followup_to ||
(mutt_str_strcasecmp(CUR_EMAIL->env->followup_to, "poster") != 0) ||
query_quadoption(FollowupToPoster,
_("Reply by mail as poster prefers?")) != MUTT_YES)
{
- if (Context && Context->mailbox->magic == MUTT_NNTP &&
+ if (Context && (Context->mailbox->magic == MUTT_NNTP) &&
!((struct NntpMboxData *) Context->mailbox->mdata)->allowed && query_quadoption(PostModerated, _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
{
break;
if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE))
break;
int rc = mutt_thread_set_flag(CUR_EMAIL, MUTT_TAG, !CUR_EMAIL->tagged,
- op == OP_TAG_THREAD ? 0 : 1);
+ (op == OP_TAG_THREAD) ? 0 : 1);
if (rc != -1)
{
if (Resolve)
}
else
{
- if (Resolve && menu->current < Context->mailbox->vcount - 1)
+ if (Resolve && menu->current < (Context->mailbox->vcount - 1))
{
menu->current++;
menu->redraw |= REDRAW_MOTION_RESYNCH;
break;
int rc = mutt_thread_set_flag(CUR_EMAIL, MUTT_DELETE, 0,
- op == OP_UNDELETE_THREAD ? 0 : 1);
+ (op == OP_UNDELETE_THREAD) ? 0 : 1);
if (rc != -1)
{
rc = mutt_thread_set_flag(CUR_EMAIL, MUTT_PURGE, 0,
- op == OP_UNDELETE_THREAD ? 0 : 1);
+ (op == OP_UNDELETE_THREAD) ? 0 : 1);
}
if (rc != -1)
{