/* If we didn't just get new mail, update the tables. */
if (occult)
- maildir_update_tables(ctx, index_hint);
+ mutt_mailbox_changed(m, MBN_RESORT);
/* do any delayed parsing we need to do. */
maildir_delayed_parsing(m, &md, NULL);
/* Incorporate new messages */
num_new = maildir_move_to_context(m, &md);
if (num_new > 0)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
mutt_buffer_pool_release(&buf);
/* If we didn't just get new mail, update the tables. */
if (occult)
- maildir_update_tables(ctx, index_hint);
+ mutt_mailbox_changed(m, MBN_RESORT);
/* Incorporate new messages */
num_new = maildir_move_to_context(m, &md);
if (num_new > 0)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
if (occult)
return MUTT_REOPENED;
/**
* reopen_mailbox - Close and reopen a mailbox
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Current email
* @retval >0 Success, e.g. #MUTT_REOPENED, #MUTT_NEW_MAIL
* @retval -1 Error
*/
-static int reopen_mailbox(struct Context *ctx, int *index_hint)
+static int reopen_mailbox(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct MboxAccountData *adata = mbox_adata_get(m);
if (!adata)
return -1;
old_sort = Sort;
Sort = SORT_ORDER;
- mutt_sort_headers(ctx, true);
+ mutt_mailbox_changed(m, MBN_RESORT);
Sort = old_sort;
}
old_msgcount = 0;
/* simulate a close */
+ mutt_mailbox_changed(m, MBN_CLOSED);
mutt_hash_free(&m->id_hash);
mutt_hash_free(&m->subj_hash);
mutt_hash_free(&m->label_hash);
- mutt_clear_threads(ctx);
FREE(&m->v2r);
if (m->readonly)
{
m->email_max = 0; /* force allocation of new headers */
m->msg_count = 0;
m->vcount = 0;
- ctx->vsize = 0;
m->msg_tagged = 0;
m->msg_deleted = 0;
m->msg_new = 0;
{
if (mbox_mbox_open(m) < 0)
return -1;
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
}
struct stat st;
mmdf_parse_mailbox(m);
if (m->msg_count > old_msg_count)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
/* Only unlock the folder if it was locked inside of this routine.
* It may have been locked elsewhere, like in
if (modified)
{
- if (reopen_mailbox(ctx, index_hint) != -1)
+ if (reopen_mailbox(m, index_hint) != -1)
{
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
if (unlock)
{
mbox_unlock_mailbox(m);
/**
* check_mailbox - Check current newsgroup for new articles
- * @param ctx Mailbox
+ * @param m Mailbox
* @retval #MUTT_REOPENED Articles have been renumbered or removed from server
* @retval #MUTT_NEW_MAIL New articles found
* @retval 0 No change
*
* Leave newsrc locked
*/
-static int check_mailbox(struct Context *ctx)
+static int check_mailbox(struct Mailbox *m)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct NntpMboxData *mdata = m->mdata;
struct NntpAccountData *adata = mdata->adata;
time_t now = time(NULL);
/* some headers were removed, context must be updated */
if (ret == MUTT_REOPENED)
- {
- mx_update_context(ctx);
- }
+ mutt_mailbox_changed(m, MBN_INVALID);
/* fetch headers of new articles */
if (mdata->last_message > mdata->last_loaded)
if (rc == 0)
{
if (m->msg_count > old_msg_count)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
mdata->last_loaded = mdata->last_message;
}
if (ret == 0 && m->msg_count > oldmsgcount)
struct Mailbox *m = ctx->mailbox;
- int ret = check_mailbox(ctx);
+ int ret = check_mailbox(m);
if (ret == 0)
{
struct NntpMboxData *mdata = m->mdata;
/* check for new articles */
mdata->adata->check_time = 0;
- rc = check_mailbox(ctx);
+ rc = check_mailbox(m);
if (rc)
return rc;
}
if (m->msg_count > mdata->oldmsgcount)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
done:
if (q)
notmuch_query_destroy(q);
int ret = pop_fetch_headers(m);
pop_clear_cache(adata);
if (m->msg_count > old_msg_count)
- mx_update_context(ctx);
+ mutt_mailbox_changed(m, MBN_INVALID);
if (ret < 0)
return -1;