unsigned int olduv, oldun;
unsigned int litlen;
short new = 0;
- short new_msg_count = 0;
char *mailbox = imap_next_word(s);
const unsigned int count = (unsigned int) ulcount;
if (mutt_str_startswith(s, "MESSAGES", CASE_MATCH))
- {
mdata->messages = count;
- new_msg_count = 1;
- }
else if (mutt_str_startswith(s, "RECENT", CASE_MATCH))
mdata->recent = count;
else if (mutt_str_startswith(s, "UIDNEXT", CASE_MATCH))
#ifdef USE_SIDEBAR
if ((m->has_new != new) || (m->msg_count != mdata->messages) ||
(m->msg_unread != mdata->unseen))
- {
mutt_menu_set_current_redraw(REDRAW_SIDEBAR);
- }
#endif
+
m->has_new = new;
- if (new_msg_count)
- m->msg_count = mdata->messages;
+ m->msg_count = mdata->messages;
m->msg_unread = mdata->unseen;
+ // force back to keep detecting new mail until the mailbox is opened
if (m->has_new)
- {
- /* force back to keep detecting new mail until the mailbox is
- opened */
mdata->uid_next = oldun;
- }
- return;
}
/**
/**
* imap_mailbox_check - Check for new mail in subscribed folders
* @param m Mailbox
- * @param check_stats Check for message stats too
* @retval num Number of mailboxes with new mail
* @retval 0 Failure
*
* Given a list of mailboxes rather than called once for each so that it can
* batch the commands and save on round trips.
*/
-int imap_mailbox_check(struct Mailbox *m, bool check_stats)
+int imap_mailbox_check(struct Mailbox *m)
{
struct ImapAccountData *adata = NULL;
struct ImapMboxData *mdata = NULL;
return -1;
}
- if (check_stats)
- {
- snprintf(command, sizeof(command),
- "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", mdata->munge_name);
- }
- else
- {
- snprintf(command, sizeof(command),
- "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", mdata->munge_name);
- }
+ snprintf(command, sizeof(command),
+ "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", mdata->munge_name);
if (imap_exec(adata, command, IMAP_CMD_QUEUE | IMAP_CMD_POLL) != IMAP_EXEC_SUCCESS)
{
}
imap_exec(adata, buf, queue ? IMAP_CMD_QUEUE : 0);
- return mdata->messages;
+ return m->msg_count;
}
/**
int imap_check_mailbox(struct Mailbox *m, bool force);
int imap_delete_mailbox(struct Mailbox *m, char *path);
int imap_sync_mailbox(struct Context *ctx, bool expunge, bool close);
-int imap_mailbox_check(struct Mailbox *m, bool check_stats);
+int imap_mailbox_check(struct Mailbox *m);
int imap_status(const char *path, bool queue);
int imap_search(struct Mailbox *m, const struct Pattern *pat);
int imap_subscribe(char *path, bool subscribe);
break;
#ifdef USE_IMAP
case MUTT_IMAP:
- if (imap_mailbox_check(m, check_stats) == 0 && m->has_new)
+ if (imap_mailbox_check(m) == 0 && m->has_new)
MailboxCount++;
break;
#endif