From: Richard Russon Date: Fri, 28 Dec 2018 11:08:37 +0000 (+0000) Subject: split out context functions X-Git-Tag: 2019-10-25~399^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5376c462e2eaa7711de0b2fbe25eb8612e79016;p=neomutt split out context functions --- diff --git a/Makefile.autosetup b/Makefile.autosetup index 77b122d07..0c5e7e768 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -62,7 +62,7 @@ ALL_FILES!= (cd $(SRCDIR) && git ls-files 2>/dev/null) || true # neomutt NEOMUTT= neomutt$(EXEEXT) NEOMUTTOBJS= account.o addrbook.o alias.o bcache.o browser.o color.o commands.o \ - complete.o compose.o compress.o conststrings.o copy.o \ + complete.o compose.o compress.o conststrings.o context.o copy.o \ curs_lib.o edit.o editmsg.o enriched.o enter.o \ filter.o flags.o git_ver.o handler.o hdrline.o help.o hook.o \ index.o init.o keymap.o mailbox.o main.o menu.o muttlib.o \ diff --git a/compose.c b/compose.c index d93b2a4e9..25394d47d 100644 --- a/compose.c +++ b/compose.c @@ -1508,7 +1508,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email else { mx_fastclose_mailbox(Context->mailbox); - mutt_context_free(&Context); + ctx_free(&Context); } /* go back to the folder we started from */ diff --git a/context.c b/context.c new file mode 100644 index 000000000..e10ca9a5e --- /dev/null +++ b/context.c @@ -0,0 +1,279 @@ +/** + * @file + * The "currently-open" mailbox + * + * @authors + * Copyright (C) 2018 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/** + * @page ctx The "currently-open" mailbox + * + * The "currently-open" mailbox + */ + +#include "config.h" +#include +#include "mutt/mutt.h" +#include "email/lib.h" +#include "context.h" +#include "globals.h" +#include "mutt_header.h" +#include "mutt_thread.h" +#include "mx.h" +#include "ncrypt/ncrypt.h" +#include "pattern.h" +#include "score.h" +#include "sort.h" + +/** + * ctx_free - Free a Context + * @param ctx Context to free + */ +void ctx_free(struct Context **ctx) +{ + if (!ctx || !*ctx) + return; + + mailbox_free(&(*ctx)->mailbox); + FREE(ctx); +} + +/** + * ctx_cleanup - Release memory and initialize a Context object + * @param ctx Context to cleanup + */ +void ctx_cleanup(struct Context *ctx) +{ + FREE(&ctx->pattern); + mutt_pattern_free(&ctx->limit_pattern); + memset(ctx, 0, sizeof(struct Context)); +} + +/** + * ctx_update - Update the Context's message counts + * @param ctx Mailbox + * + * this routine is called to update the counts in the context structure + */ +void ctx_update(struct Context *ctx) +{ + if (!ctx || !ctx->mailbox) + return; + + struct Mailbox *m = ctx->mailbox; + + mutt_hash_free(&m->subj_hash); + mutt_hash_free(&m->id_hash); + + /* reset counters */ + m->msg_unread = 0; + m->msg_flagged = 0; + m->msg_new = 0; + m->msg_deleted = 0; + m->msg_tagged = 0; + m->vcount = 0; + m->changed = false; + + mutt_clear_threads(ctx); + + struct Email *e = NULL; + for (int msgno = 0; msgno < m->msg_count; msgno++) + { + e = m->emails[msgno]; + + if (WithCrypto) + { + /* NOTE: this _must_ be done before the check for mailcap! */ + e->security = crypt_query(e->content); + } + + if (!ctx->pattern) + { + m->v2r[m->vcount] = msgno; + e->virtual = m->vcount++; + } + else + e->virtual = -1; + e->msgno = msgno; + + if (e->env->supersedes) + { + struct Email *e2 = NULL; + + if (!m->id_hash) + m->id_hash = mutt_make_id_hash(m); + + e2 = mutt_hash_find(m->id_hash, e->env->supersedes); + if (e2) + { + e2->superseded = true; + if (Score) + mutt_score_message(ctx->mailbox, e2, true); + } + } + + /* add this message to the hash tables */ + if (m->id_hash && e->env->message_id) + mutt_hash_insert(m->id_hash, e->env->message_id, e); + if (m->subj_hash && e->env->real_subj) + mutt_hash_insert(m->subj_hash, e->env->real_subj, e); + mutt_label_hash_add(m, e); + + if (Score) + mutt_score_message(ctx->mailbox, e, false); + + if (e->changed) + m->changed = true; + if (e->flagged) + m->msg_flagged++; + if (e->deleted) + m->msg_deleted++; + if (!e->read) + { + m->msg_unread++; + if (!e->old) + m->msg_new++; + } + } + + mutt_sort_headers(ctx, true); /* rethread from scratch */ +} + +/** + * ctx_update_tables - Update a Context structure's internal tables + * @param ctx Mailbox + * @param committing Commit the changes? + */ +void ctx_update_tables(struct Context *ctx, bool committing) +{ + if (!ctx || !ctx->mailbox) + return; + + struct Mailbox *m = ctx->mailbox; + + int i, j, padding; + + /* update memory to reflect the new state of the mailbox */ + m->vcount = 0; + ctx->vsize = 0; + m->msg_tagged = 0; + m->msg_deleted = 0; + m->msg_new = 0; + m->msg_unread = 0; + m->changed = false; + m->msg_flagged = 0; + padding = mx_msg_padding_size(m); + for (i = 0, j = 0; i < m->msg_count; i++) + { + if (!m->emails[i]->quasi_deleted && + ((committing && (!m->emails[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))) || + (!committing && m->emails[i]->active))) + { + if (i != j) + { + m->emails[j] = m->emails[i]; + m->emails[i] = NULL; + } + m->emails[j]->msgno = j; + if (m->emails[j]->virtual != -1) + { + m->v2r[m->vcount] = j; + m->emails[j]->virtual = m->vcount++; + struct Body *b = m->emails[j]->content; + ctx->vsize += b->length + b->offset - b->hdr_offset + padding; + } + + if (committing) + m->emails[j]->changed = false; + else if (m->emails[j]->changed) + m->changed = true; + + if (!committing || (m->magic == MUTT_MAILDIR && MaildirTrash)) + { + if (m->emails[j]->deleted) + m->msg_deleted++; + } + + if (m->emails[j]->tagged) + m->msg_tagged++; + if (m->emails[j]->flagged) + m->msg_flagged++; + if (!m->emails[j]->read) + { + m->msg_unread++; + if (!m->emails[j]->old) + m->msg_new++; + } + + j++; + } + else + { + if (m->magic == MUTT_MH || m->magic == MUTT_MAILDIR) + { + m->size -= (m->emails[i]->content->length + m->emails[i]->content->offset - + m->emails[i]->content->hdr_offset); + } + /* remove message from the hash tables */ + if (m->subj_hash && m->emails[i]->env->real_subj) + mutt_hash_delete(m->subj_hash, m->emails[i]->env->real_subj, m->emails[i]); + if (m->id_hash && m->emails[i]->env->message_id) + mutt_hash_delete(m->id_hash, m->emails[i]->env->message_id, m->emails[i]); + mutt_label_hash_remove(m, m->emails[i]); + /* The path mx_mbox_check() -> imap_check_mailbox() -> + * imap_expunge_mailbox() -> ctx_update_tables() + * can occur before a call to mx_mbox_sync(), resulting in + * last_tag being stale if it's not reset here. + */ + if (ctx->last_tag == m->emails[i]) + ctx->last_tag = NULL; + mutt_email_free(&m->emails[i]); + } + } + m->msg_count = j; +} + +/** + * ctx_mailbox_changed - Act on a Mailbox change notification + * @param m Mailbox + * @param action Event occurring + * @param ndata Private notification data + */ +void ctx_mailbox_changed(struct Mailbox *m, enum MailboxNotification action) +{ + if (!m || !m->ndata) + return; + + struct Context *ctx = m->ndata; + + switch (action) + { + case MBN_CLOSED: + mutt_clear_threads(ctx); + ctx_cleanup(ctx); + break; + case MBN_INVALID: + ctx_update(ctx); + break; + case MBN_RESORT: + ctx_update_tables(ctx, false); + mutt_sort_headers(ctx, true); + break; + } +} + diff --git a/context.h b/context.h index 02a2786db..af73c2e6f 100644 --- a/context.h +++ b/context.h @@ -27,8 +27,7 @@ #include #include #include - -struct Mailbox; +#include "mailbox.h" /** * struct Context - The "current" mailbox @@ -50,4 +49,9 @@ struct Context struct Mailbox *mailbox; }; +void ctx_free(struct Context **ctx); +void ctx_mailbox_changed(struct Mailbox *m, enum MailboxNotification action); +void ctx_update(struct Context *ctx); +void ctx_update_tables(struct Context *ctx, bool committing); + #endif /* MUTT_CONTEXT_H */ diff --git a/imap/imap.c b/imap/imap.c index 18001e2a3..38699564e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -820,7 +820,7 @@ void imap_expunge_mailbox(struct Mailbox *m) * flag becomes set (e.g. a flag update to a modified header), * this function will be called by imap_cmd_finish(). * - * The mx_update_tables() will free and remove these "inactive" headers, + * The ctx_update_tables() will free and remove these "inactive" headers, * despite that an EXPUNGE was not received for them. * This would result in memory leaks and segfaults due to dangling * pointers in the msn_index and uid_hash. diff --git a/imap/message.c b/imap/message.c index d1ce0bb62..03dac63af 100644 --- a/imap/message.c +++ b/imap/message.c @@ -976,7 +976,7 @@ static int read_headers_condstore_qresync_updates(struct ImapAccountData *adata, imap_expunge_mailbox(m); /* undo expunge count updates. - * mx_update_context() will do this at the end of the header fetch. */ + * ctx_update() will do this at the end of the header fetch. */ m->vcount = 0; m->msg_tagged = 0; m->msg_deleted = 0; diff --git a/index.c b/index.c index 9b2beb8a5..9e1bd9f9c 100644 --- a/index.c +++ b/index.c @@ -587,7 +587,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m, /* keepalive failure in mutt_enter_fname may kill connection. #3028 */ if (Context && (Context->mailbox->path[0] == '\0')) - mutt_context_free(&Context); + ctx_free(&Context); if (Context) { @@ -1067,7 +1067,7 @@ int mutt_index_menu(void) if (!Context->mailbox || Context->mailbox->path[0] == '\0') { /* fatal error occurred */ - mutt_context_free(&Context); + ctx_free(&Context); menu->redraw = REDRAW_FULL; } @@ -1886,7 +1886,7 @@ int mutt_index_menu(void) /* check for a fatal error, or all messages deleted */ if (Context->mailbox->path[0] == '\0') - mutt_context_free(&Context); + ctx_free(&Context); /* if we were in the pager, redisplay the message */ if (menu->menu == MENU_PAGER) @@ -2332,7 +2332,7 @@ int mutt_index_menu(void) if (Context) { mx_fastclose_mailbox(Context->mailbox); - mutt_context_free(&Context); + ctx_free(&Context); } done = true; } diff --git a/mailbox.c b/mailbox.c index df7a15474..c51988069 100644 --- a/mailbox.c +++ b/mailbox.c @@ -114,12 +114,6 @@ void mailbox_free(struct Mailbox **m) mutt_mailbox_changed(*m, MBN_CLOSED); - if (Context && Context->mailbox && Context->mailbox == *m) - { - mx_cleanup_context(Context); - FREE(&Context); - } - FREE(&(*m)->desc); if ((*m)->mdata && (*m)->free_mdata) (*m)->free_mdata(&(*m)->mdata); @@ -756,19 +750,6 @@ void mutt_mailbox(char *s, size_t slen) *s = '\0'; } -/** - * mutt_context_free - Free a Context - * @param ctx Context to free - */ -void mutt_context_free(struct Context **ctx) -{ - if (!ctx || !*ctx) - return; - - mailbox_free(&(*ctx)->mailbox); - FREE(ctx); -} - /** * mutt_mailbox_changed - Notify listeners of a change to a Mailbox * @param m Mailbox diff --git a/mailbox.h b/mailbox.h index 6cd807a77..066cae4f0 100644 --- a/mailbox.h +++ b/mailbox.h @@ -33,7 +33,6 @@ #include "where.h" struct Buffer; -struct Context; struct Account; struct stat; @@ -160,7 +159,6 @@ extern struct MailboxList AllMailboxes; ///< List of all Mailboxes struct Mailbox *mailbox_new(void); void mailbox_free(struct Mailbox **m); -void mutt_context_free(struct Context **ctx); struct Mailbox *mutt_find_mailbox(const char *path); struct Mailbox *mutt_find_mailbox_desc(const char *desc); diff --git a/maildir/shared.c b/maildir/shared.c index d2248e129..7d53ada04 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -1234,7 +1234,7 @@ void maildir_update_tables(struct Context *ctx, int *index_hint) m->emails[i]->index = j++; } - mx_update_tables(ctx, false); + ctx_update_tables(ctx, false); mutt_clear_threads(ctx); } diff --git a/main.c b/main.c index 1ba423bd9..a0208e05b 100644 --- a/main.c +++ b/main.c @@ -1214,7 +1214,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_sb_set_open_mailbox(); #endif mutt_index_menu(); - mutt_context_free(&Context); + ctx_free(&Context); } #ifdef USE_IMAP imap_logout_all(); diff --git a/mx.c b/mx.c index 023016bbb..f386a818e 100644 --- a/mx.c +++ b/mx.c @@ -236,35 +236,6 @@ static int mx_open_mailbox_append(struct Mailbox *m, int flags) return rc; } -/** - * mx_mailbox_changed - Act on a Mailbox change notification - * @param m Mailbox - * @param action Event occurring - * @param ndata Private notification data - */ -void mx_mailbox_changed(struct Mailbox *m, enum MailboxNotification action) -{ - if (!m || !m->ndata) - return; - - struct Context *ctx = m->ndata; - - switch (action) - { - case MBN_CLOSED: - mutt_clear_threads(ctx); - mx_cleanup_context(ctx); - break; - case MBN_INVALID: - mx_update_context(ctx); - break; - case MBN_RESORT: - mx_update_tables(ctx, false); - mutt_sort_headers(ctx, true); - break; - } -} - /** * mx_mbox_open - Open a mailbox and parse it * @param m Mailbox to open @@ -302,7 +273,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags) /* int rc = */ mx_path_canon2(m, Folder); } - m->notify = mx_mailbox_changed; + m->notify = ctx_mailbox_changed; m->ndata = ctx; if ((m->magic == MUTT_UNKNOWN) && (flags & MUTT_NEWFOLDER)) @@ -356,7 +327,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags) if (mx_open_mailbox_append(ctx->mailbox, flags) != 0) { mx_fastclose_mailbox(m); - mutt_context_free(&ctx); + ctx_free(&ctx); return NULL; } return ctx; @@ -379,7 +350,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags) mutt_error(_("%s is not a mailbox"), path); mx_fastclose_mailbox(m); - mutt_context_free(&ctx); + ctx_free(&ctx); return NULL; } @@ -398,7 +369,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags) int rc = m->mx_ops->mbox_open(ctx->mailbox); m->opened++; if (rc == 0) - mx_update_context(ctx); + ctx_update(ctx); if ((rc == 0) || (rc == -2)) { @@ -418,7 +389,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags) else { mx_fastclose_mailbox(m); - mutt_context_free(&ctx); + ctx_free(&ctx); } OptForceRefresh = false; @@ -844,100 +815,6 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) return 0; } -/** - * mx_update_tables - Update a Context structure's internal tables - * @param ctx Mailbox - * @param committing Commit the changes? - */ -void mx_update_tables(struct Context *ctx, bool committing) -{ - if (!ctx || !ctx->mailbox) - return; - - struct Mailbox *m = ctx->mailbox; - - int i, j, padding; - - /* update memory to reflect the new state of the mailbox */ - m->vcount = 0; - ctx->vsize = 0; - m->msg_tagged = 0; - m->msg_deleted = 0; - m->msg_new = 0; - m->msg_unread = 0; - m->changed = false; - m->msg_flagged = 0; - padding = mx_msg_padding_size(m); - for (i = 0, j = 0; i < m->msg_count; i++) - { - if (!m->emails[i]->quasi_deleted && - ((committing && (!m->emails[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))) || - (!committing && m->emails[i]->active))) - { - if (i != j) - { - m->emails[j] = m->emails[i]; - m->emails[i] = NULL; - } - m->emails[j]->msgno = j; - if (m->emails[j]->virtual != -1) - { - m->v2r[m->vcount] = j; - m->emails[j]->virtual = m->vcount++; - struct Body *b = m->emails[j]->content; - ctx->vsize += b->length + b->offset - b->hdr_offset + padding; - } - - if (committing) - m->emails[j]->changed = false; - else if (m->emails[j]->changed) - m->changed = true; - - if (!committing || (m->magic == MUTT_MAILDIR && MaildirTrash)) - { - if (m->emails[j]->deleted) - m->msg_deleted++; - } - - if (m->emails[j]->tagged) - m->msg_tagged++; - if (m->emails[j]->flagged) - m->msg_flagged++; - if (!m->emails[j]->read) - { - m->msg_unread++; - if (!m->emails[j]->old) - m->msg_new++; - } - - j++; - } - else - { - if (m->magic == MUTT_MH || m->magic == MUTT_MAILDIR) - { - m->size -= (m->emails[i]->content->length + m->emails[i]->content->offset - - m->emails[i]->content->hdr_offset); - } - /* remove message from the hash tables */ - if (m->subj_hash && m->emails[i]->env->real_subj) - mutt_hash_delete(m->subj_hash, m->emails[i]->env->real_subj, m->emails[i]); - if (m->id_hash && m->emails[i]->env->message_id) - mutt_hash_delete(m->id_hash, m->emails[i]->env->message_id, m->emails[i]); - mutt_label_hash_remove(m, m->emails[i]); - /* The path mx_mbox_check() -> imap_check_mailbox() -> - * imap_expunge_mailbox() -> mx_update_tables() - * can occur before a call to mx_mbox_sync(), resulting in - * last_tag being stale if it's not reset here. - */ - if (ctx->last_tag == m->emails[i]) - ctx->last_tag = NULL; - mutt_email_free(&m->emails[i]); - } - } - m->msg_count = j; -} - /** * mx_mbox_sync - Save changes to mailbox * @param[in] ctx Context @@ -1010,7 +887,7 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint) } /* really only for IMAP - imap_sync_mailbox results in a call to - * mx_update_tables, so m->msg_deleted is 0 when it comes back */ + * ctx_update_tables, so m->msg_deleted is 0 when it comes back */ msgcount = m->msg_count; deleted = m->msg_deleted; @@ -1063,7 +940,7 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint) /* IMAP does this automatically after handling EXPUNGE */ if (m->magic != MUTT_IMAP) { - mx_update_tables(ctx, true); + ctx_update_tables(ctx, true); mutt_sort_headers(ctx, true); /* rethread from scratch */ } } @@ -1264,96 +1141,6 @@ void mx_alloc_memory(struct Mailbox *m) } } -/** - * mx_update_context - Update the Context's message counts - * @param ctx Mailbox - * - * this routine is called to update the counts in the context structure - */ -void mx_update_context(struct Context *ctx) -{ - if (!ctx || !ctx->mailbox) - return; - - struct Mailbox *m = ctx->mailbox; - - mutt_hash_free(&m->subj_hash); - mutt_hash_free(&m->id_hash); - - /* reset counters */ - m->msg_unread = 0; - m->msg_flagged = 0; - m->msg_new = 0; - m->msg_deleted = 0; - m->msg_tagged = 0; - m->vcount = 0; - m->changed = false; - - mutt_clear_threads(ctx); - - struct Email *e = NULL; - for (int msgno = 0; msgno < m->msg_count; msgno++) - { - e = m->emails[msgno]; - - if (WithCrypto) - { - /* NOTE: this _must_ be done before the check for mailcap! */ - e->security = crypt_query(e->content); - } - - if (!ctx->pattern) - { - m->v2r[m->vcount] = msgno; - e->virtual = m->vcount++; - } - else - e->virtual = -1; - e->msgno = msgno; - - if (e->env->supersedes) - { - struct Email *e2 = NULL; - - if (!m->id_hash) - m->id_hash = mutt_make_id_hash(m); - - e2 = mutt_hash_find(m->id_hash, e->env->supersedes); - if (e2) - { - e2->superseded = true; - if (Score) - mutt_score_message(ctx->mailbox, e2, true); - } - } - - /* add this message to the hash tables */ - if (m->id_hash && e->env->message_id) - mutt_hash_insert(m->id_hash, e->env->message_id, e); - if (m->subj_hash && e->env->real_subj) - mutt_hash_insert(m->subj_hash, e->env->real_subj, e); - mutt_label_hash_add(m, e); - - if (Score) - mutt_score_message(ctx->mailbox, e, false); - - if (e->changed) - m->changed = true; - if (e->flagged) - m->msg_flagged++; - if (e->deleted) - m->msg_deleted++; - if (!e->read) - { - m->msg_unread++; - if (!e->old) - m->msg_new++; - } - } - - mutt_sort_headers(ctx, true); /* rethread from scratch */ -} - /** * mx_check_empty - Is the mailbox empty * @param path Mailbox to check @@ -1776,17 +1563,6 @@ int mx_ac_remove(struct Mailbox *m) return 0; } -/** - * mx_cleanup_context - Release memory and initialize a Context object - * @param ctx Context to cleanup - */ -void mx_cleanup_context(struct Context *ctx) -{ - FREE(&ctx->pattern); - mutt_pattern_free(&ctx->limit_pattern); - memset(ctx, 0, sizeof(struct Context)); -} - /** * mx_mbox_check_stats - Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats */ diff --git a/mx.h b/mx.h index 08260b785..4ba8b8e22 100644 --- a/mx.h +++ b/mx.h @@ -290,8 +290,5 @@ int mx_check_empty (const char *path); void mx_fastclose_mailbox(struct Mailbox *m); const struct MxOps *mx_get_ops (enum MailboxType magic); bool mx_tags_is_supported(struct Mailbox *m); -void mx_update_context (struct Context *ctx); -void mx_update_tables (struct Context *ctx, bool committing); -void mx_cleanup_context (struct Context *ctx); #endif /* MUTT_MX_H */ diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 30104912e..dd5a3f66a 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -1197,7 +1197,7 @@ void nntp_article_status(struct Mailbox *m, struct Email *e, char *group, anum_t { if ((anum >= mdata->newsrc_ent[i].first) && (anum <= mdata->newsrc_ent[i].last)) { - /* can't use mutt_set_flag() because mx_update_context() + /* can't use mutt_set_flag() because ctx_update() didn't get called yet */ e->read = true; return; diff --git a/nntp/nntp.c b/nntp/nntp.c index ba9f59edb..54239017b 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -2286,7 +2286,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) e->changed = true; e->received = e->date_sent; e->index = m->msg_count++; - mx_update_context(ctx); + ctx_update(ctx); return 0; } @@ -2356,7 +2356,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid) break; } if (m->msg_count > old_msg_count) - mx_update_context(ctx); + ctx_update(ctx); #ifdef USE_HCACHE mutt_hcache_close(hc); @@ -2808,7 +2808,7 @@ static int nntp_msg_open(struct Mailbox *m, struct Message *msg, int msgno) nntp_edata_get(e)->parsed = true; mutt_parse_mime_message(m, e); - /* these would normally be updated in mx_update_context(), but the + /* these would normally be updated in ctx_update(), but the * full headers aren't parsed with overview, so the information wasn't * available then */ if (WithCrypto) diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 424a60837..7a5778032 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -1632,7 +1632,7 @@ int nm_read_entire_thread(struct Context *ctx, struct Email *e) rc = 0; if (m->msg_count > mdata->oldmsgcount) - mx_update_context(ctx); + ctx_update(ctx); done: if (q) notmuch_query_destroy(q); diff --git a/pager.c b/pager.c index 61f621dd2..ef33c832c 100644 --- a/pager.c +++ b/pager.c @@ -2361,7 +2361,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e if (!Context->mailbox || Context->mailbox->path[0] == '\0') { /* fatal error occurred */ - mutt_context_free(&Context); + ctx_free(&Context); pager_menu->redraw = REDRAW_FULL; break; } diff --git a/postpone.c b/postpone.c index e5ba3792a..ab98309a0 100644 --- a/postpone.c +++ b/postpone.c @@ -176,7 +176,7 @@ int mutt_num_postponed(struct Mailbox *m, bool force) else PostCount = ctx->mailbox->msg_count; mx_fastclose_mailbox(ctx->mailbox); - mutt_context_free(&ctx); + ctx_free(&ctx); #ifdef USE_NNTP if (optnews) OptNews = true;