]> granicus.if.org Git - neomutt/commitdiff
mx_mbox_close drop index_hint
authorRichard Russon <rich@flatcap.org>
Sun, 30 Dec 2018 02:29:04 +0000 (02:29 +0000)
committerRichard Russon <rich@flatcap.org>
Sat, 5 Jan 2019 14:44:35 +0000 (14:44 +0000)
commands.c
compose.c
editmsg.c
index.c
mbox/mbox.c
mutt_attach.c
mx.c
mx.h
pop/pop.c
postpone.c
sendlib.c

index e2604183188eea3900d5e5bb498db80021282414..912df7a6d2e934dc3640147479fb3b21c2ab7e27 100644 (file)
@@ -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);
index 25394d47d5d55466b910039dbb06218df96395c3..944f3ef52fb9a7aa799303a8c14efcd5e739e277 100644 (file)
--- 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);
index e6b1c7956103235981c24b7162c0dbc8d6effcce..c38a84c443b035e063b1aadd7f4361a722ab24e5 100644 (file)
--- 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 9e1bd9f9c928a8ad437b349b91db2ae8298a2e3b..cae9266b786bc9bbea4f5c629013567f91507832 100644 (file)
--- 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))
index e31e0543878faabe1d462884cbc05b59b1dd613d..028f13235f597a1cc72094450430402de289382f 100644 (file)
@@ -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);
     }
   }
 
index f6387aa5c789ce1f8b55ca448fe4fe3f59388f23..81507fd6fd865641c131bee8c07321fac22fd7ee 100644 (file)
@@ -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 f386a818e28d584138995a6845f34c06d8ebfd49..46a67737327b80d085f411ff610308957b6cc3d6 100644 (file)
--- 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 4ba8b8e223c62641855141188db926cad39ff462..0ec265b4d6c32bd1d42d34774778ae1d501b8644 100644 (file)
--- 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);
index 71acc00f9cf09839d7e94583c8c56781345cf3c3..4cfd6231a0e6765d1fd9db058b5da9f69ea5ca2f 100644 (file)
--- 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)
   {
index ab98309a040036d1e196a13f10f539f56bf8bfe9..cd3f1cd29b1e7c7ad5640a2815ccd09c29c48a9b 100644 (file)
@@ -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;
index 22b364c214c921947d3c190086fec06a994ed0a1..958fb2473fcf54bf8ab430a35dc530a57666790e 100644 (file)
--- 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);