From: Richard Russon Date: Sun, 30 Dec 2018 02:29:04 +0000 (+0000) Subject: mx_mbox_close drop index_hint X-Git-Tag: 2019-10-25~399^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1301cc7acac1a98524e727b146ec317e7064c3f6;p=neomutt mx_mbox_close drop index_hint --- diff --git a/commands.c b/commands.c index e26041831..912df7a6d 100644 --- a/commands.c +++ b/commands.c @@ -1026,7 +1026,7 @@ int mutt_save_message(struct Email *e, bool delete, bool decode, bool decrypt) { if (mutt_save_message_ctx(e, delete, decode, decrypt, savectx->mailbox) != 0) { - mx_mbox_close(&savectx, NULL); + mx_mbox_close(&savectx); return -1; } #ifdef USE_COMPRESSED @@ -1084,7 +1084,7 @@ int mutt_save_message(struct Email *e, bool delete, bool decode, bool decrypt) #endif if (rc != 0) { - mx_mbox_close(&savectx, NULL); + mx_mbox_close(&savectx); return -1; } } @@ -1092,7 +1092,7 @@ int mutt_save_message(struct Email *e, bool delete, bool decode, bool decrypt) const bool need_mailbox_cleanup = ((savectx->mailbox->magic == MUTT_MBOX) || (savectx->mailbox->magic == MUTT_MMDF)); - mx_mbox_close(&savectx, NULL); + mx_mbox_close(&savectx); if (need_mailbox_cleanup) mutt_mailbox_cleanup(buf, &st); diff --git a/compose.c b/compose.c index 25394d47d..944f3ef52 100644 --- a/compose.c +++ b/compose.c @@ -1459,7 +1459,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email if (!ctx->mailbox->msg_count) { - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); mutt_error(_("No messages in that folder")); break; } @@ -1504,7 +1504,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email menu->redraw |= REDRAW_FULL; if (close == OP_QUIT) - mx_mbox_close(&Context, NULL); + mx_mbox_close(&Context); else { mx_fastclose_mailbox(Context->mailbox); diff --git a/editmsg.c b/editmsg.c index e6b1c7956..c38a84c44 100644 --- a/editmsg.c +++ b/editmsg.c @@ -98,7 +98,7 @@ static int edit_or_view_one_message(bool edit, struct Mailbox *m, struct Email * rc = mutt_append_message(tmpctx->mailbox, m, cur, 0, chflags); oerrno = errno; - mx_mbox_close(&tmpctx, NULL); + mx_mbox_close(&tmpctx); if (rc == -1) { @@ -221,7 +221,7 @@ static int edit_or_view_one_message(bool edit, struct Mailbox *m, struct Email * if (!msg) { mutt_error(_("Can't append to folder: %s"), strerror(errno)); - mx_mbox_close(&tmpctx, NULL); + mx_mbox_close(&tmpctx); goto bail; } @@ -235,7 +235,7 @@ static int edit_or_view_one_message(bool edit, struct Mailbox *m, struct Email * rc = mx_msg_commit(tmpctx->mailbox, msg); mx_msg_close(tmpctx->mailbox, &msg); - mx_mbox_close(&tmpctx, NULL); + mx_mbox_close(&tmpctx); bail: mutt_file_fclose(&fp); diff --git a/index.c b/index.c index 9e1bd9f9c..cae9266b7 100644 --- a/index.c +++ b/index.c @@ -603,7 +603,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m, new_last_folder = mutt_str_strdup(Context->mailbox->path); *oldcount = Context ? Context->mailbox->msg_count : 0; - int check = mx_mbox_close(&Context, index_hint); + int check = mx_mbox_close(&Context); if (check != 0) { #ifdef USE_INOTIFY @@ -1672,7 +1672,7 @@ int mutt_index_menu(void) mutt_startup_shutdown_hook(MUTT_SHUTDOWN_HOOK); - if (!Context || (check = mx_mbox_close(&Context, &index_hint)) == 0) + if (!Context || (check = mx_mbox_close(&Context)) == 0) done = true; else { @@ -1812,7 +1812,7 @@ int mutt_index_menu(void) case OP_MAIN_IMAP_LOGOUT_ALL: if (Context && Context->mailbox->magic == MUTT_IMAP) { - int check = mx_mbox_close(&Context, &index_hint); + int check = mx_mbox_close(&Context); if (check != 0) { if ((check == MUTT_NEW_MAIL) || (check == MUTT_REOPENED)) diff --git a/mbox/mbox.c b/mbox/mbox.c index e31e05438..028f13235 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -1808,7 +1808,7 @@ static int mbox_mbox_check_stats(struct Mailbox *m, int flags) m->msg_unread = ctx->mailbox->msg_unread; m->msg_flagged = ctx->mailbox->msg_flagged; m->stats_last_checked = ctx->mailbox->mtime; - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); } } diff --git a/mutt_attach.c b/mutt_attach.c index f6387aa5c..81507fd6f 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -819,7 +819,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct msg = mx_msg_open_new(ctx->mailbox, en, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM); if (!msg) { - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); return -1; } if ((ctx->mailbox->magic == MUTT_MBOX) || (ctx->mailbox->magic == MUTT_MMDF)) @@ -836,7 +836,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct } mx_msg_close(ctx->mailbox, &msg); - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); return r; } else diff --git a/mx.c b/mx.c index f386a818e..46a677373 100644 --- a/mx.c +++ b/mx.c @@ -537,13 +537,13 @@ static int trash_append(struct Mailbox *m) { if (mutt_append_message(ctx_trash->mailbox, m, m->emails[i], 0, 0) == -1) { - mx_mbox_close(&ctx_trash, NULL); + mx_mbox_close(&ctx_trash); return -1; } } } - mx_mbox_close(&ctx_trash, NULL); + mx_mbox_close(&ctx_trash); } else { @@ -557,13 +557,12 @@ static int trash_append(struct Mailbox *m) /** * mx_mbox_close - Save changes and close mailbox * @param pctx Mailbox - * @param index_hint Current email * @retval 0 Success * @retval -1 Failure * * @note Context will be freed after it's closed */ -int mx_mbox_close(struct Context **pctx, int *index_hint) +int mx_mbox_close(struct Context **pctx) { if (!pctx || !*pctx) return 0; @@ -719,13 +718,13 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) } else { - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); return -1; } } } - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); } } else if (!m->changed && m->msg_deleted == 0) @@ -769,7 +768,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) if (m->changed || (m->msg_deleted != 0)) { - int check = sync_mailbox(ctx, index_hint); + int check = sync_mailbox(ctx, NULL); if (check != 0) return check; } diff --git a/mx.h b/mx.h index 4ba8b8e22..0ec265b4d 100644 --- a/mx.h +++ b/mx.h @@ -262,7 +262,7 @@ struct MxOps /* Wrappers for the Mailbox API, see MxOps */ int mx_mbox_check (struct Mailbox *m, int *index_hint); int mx_mbox_check_stats(struct Mailbox *m, int flags); -int mx_mbox_close (struct Context **pctx, int *index_hint); +int mx_mbox_close (struct Context **pctx); struct Context *mx_mbox_open (struct Mailbox *m, const char *path, int flags); int mx_mbox_sync (struct Context *ctx, int *index_hint); int mx_msg_close (struct Mailbox *m, struct Message **msg); diff --git a/pop/pop.c b/pop/pop.c index 71acc00f9..4cfd6231a 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -697,7 +697,7 @@ void pop_fetch_mail(void) if (ret == -1) { - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); goto fail; } if (ret == -2) @@ -718,7 +718,7 @@ void pop_fetch_mail(void) msgbuf, i - last, msgs - last); } - mx_mbox_close(&ctx, NULL); + mx_mbox_close(&ctx); if (rset) { diff --git a/postpone.c b/postpone.c index ab98309a0..cd3f1cd29 100644 --- a/postpone.c +++ b/postpone.c @@ -314,7 +314,7 @@ int mutt_get_postponed(struct Context *ctx, struct Email *hdr, if (PostContext == ctx) PostContext = NULL; else - mx_mbox_close(&PostContext, NULL); + mx_mbox_close(&PostContext); mutt_error(_("No postponed messages")); return -1; } @@ -329,7 +329,7 @@ int mutt_get_postponed(struct Context *ctx, struct Email *hdr, if (PostContext == ctx) PostContext = NULL; else - mx_mbox_close(&PostContext, NULL); + mx_mbox_close(&PostContext); return -1; } @@ -356,7 +356,7 @@ int mutt_get_postponed(struct Context *ctx, struct Email *hdr, if (PostContext == ctx) PostContext = NULL; else - mx_mbox_close(&PostContext, NULL); + mx_mbox_close(&PostContext); Delete = opt_delete; struct ListNode *np, *tmp; diff --git a/sendlib.c b/sendlib.c index 22b364c21..958fb2473 100644 --- a/sendlib.c +++ b/sendlib.c @@ -3199,7 +3199,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, if (!tempfp) { mutt_perror(tempfile); - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); goto done; } /* remember new mail status before appending message */ @@ -3215,7 +3215,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, if (!msg) { mutt_file_fclose(&tempfp); - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); goto done; } @@ -3333,7 +3333,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, unlink(tempfile); mx_msg_commit(f->mailbox, msg); /* XXX really? */ mx_msg_close(f->mailbox, &msg); - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); goto done; } @@ -3364,7 +3364,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, else if (finalpath) *finalpath = mutt_str_strdup(msg->committed_path); mx_msg_close(f->mailbox, &msg); - mx_mbox_close(&f, NULL); + mx_mbox_close(&f); if (!post && need_mailbox_cleanup) mutt_mailbox_cleanup(path, &st);