Commit
e3f66d7e fixed dropped new mail notications, removing the
unsetting of idata->reopen IMAP_NEWMAIL_PENDING in imap_cmd_finish()
when an EXPUNGE was processed.
However, imap_cmd_finish() can be called twice by
imap_check_mailbox(). First as part of the imap_exec(), and manually
again just below.
Now that the IMAP_NEWMAIL_PENDING still exists, a second call could
overwrite idata->check_status if both reopen flags were set.
This unfortunately affects update_index(), which behaves differently
for MUTT_REOPENED.
I need to change the return value of mx_check_mailbox() in master to
preserve all the bits, so the index can both notify of new mail and
update_index() properly.
For stable, the best fix is to use bit operators to enable the
check_status flags in imap_cmd_finish() (and cmd_parse_fetch for
flags), and keep the imap_check_mailbox() priority of setting its
return value (it prioritizes IMAP_EXCHANGE_PENDING).
dprint (2, (debugfile, "imap_cmd_finish: Fetching new mail\n"));
/* check_status: curs_main uses imap_check_mailbox to detect
* whether the index needs updating */
- idata->check_status = IMAP_NEWMAIL_PENDING;
+ idata->check_status |= IMAP_NEWMAIL_PENDING;
imap_read_headers (idata, idata->max_msn+1, count, 0);
}
else if (idata->reopen & IMAP_EXPUNGE_PENDING)
/* Detect whether we've gotten unexpected EXPUNGE messages */
if ((idata->reopen & IMAP_EXPUNGE_PENDING) &&
!(idata->reopen & IMAP_EXPUNGE_EXPECTED))
- idata->check_status = IMAP_EXPUNGE_PENDING;
+ idata->check_status |= IMAP_EXPUNGE_PENDING;
idata->reopen &= ~(IMAP_EXPUNGE_PENDING | IMAP_EXPUNGE_EXPECTED);
}
}
if (h->changed)
idata->reopen |= IMAP_EXPUNGE_PENDING;
else
- idata->check_status = IMAP_FLAGS_PENDING;
+ idata->check_status |= IMAP_FLAGS_PENDING;
}
}
}