]> granicus.if.org Git - neomutt/commitdiff
mx api: rename mx functions to match api
authorRichard Russon <rich@flatcap.org>
Wed, 6 Jun 2018 01:27:15 +0000 (02:27 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 6 Jun 2018 12:31:45 +0000 (13:31 +0100)
21 files changed:
attach.c
buffy.c
commands.c
compose.c
compress.c
copy.c
curs_main.c
editmsg.c
imap/imap.c
mailbox.h
main.c
mh.c
mx.c
mx.h
pager.c
parse.c
pattern.c
pop.c
postpone.c
recvattach.c
sendlib.c

index 025134056b025fe2d447dec27d23c0c6a4b53cd2..c9f8c99942e153dedcd4ebf42e33d9e89cda488c 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -786,19 +786,19 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct
         return -1;
       if (fgets(buf, sizeof(buf), fp) == NULL)
         return -1;
-      if (mx_open_mailbox(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL)
+      if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL)
         return -1;
-      msg = mx_open_new_message(&ctx, hn, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
+      msg = mx_msg_open_new(&ctx, hn, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
       if (!msg)
       {
-        mx_close_mailbox(&ctx, NULL);
+        mx_mbox_close(&ctx, NULL);
         return -1;
       }
       if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF)
         chflags = CH_FROM | CH_UPDATE_LEN;
       chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
       if (mutt_copy_message_fp(msg->fp, fp, hn, 0, chflags) == 0 &&
-          mx_commit_message(&ctx, msg) == 0)
+          mx_msg_commit(&ctx, msg) == 0)
       {
         r = 0;
       }
@@ -807,8 +807,8 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct
         r = -1;
       }
 
-      mx_close_message(&ctx, &msg);
-      mx_close_mailbox(&ctx, NULL);
+      mx_msg_close(&ctx, &msg);
+      mx_mbox_close(&ctx, NULL);
       return r;
     }
     else
diff --git a/buffy.c b/buffy.c
index 736c904e64aa22d1369b2fef668cfc045f5f7b9b..3b256748cdd2a603386618f808b55b52b2712480 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -331,14 +331,14 @@ static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, bool check_s
 
   if (check_stats && (mailbox->stats_last_checked < sb->st_mtime))
   {
-    if (mx_open_mailbox(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
+    if (mx_mbox_open(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
                         &ctx) != NULL)
     {
       mailbox->msg_count = ctx.msgcount;
       mailbox->msg_unread = ctx.unread;
       mailbox->msg_flagged = ctx.flagged;
       mailbox->stats_last_checked = ctx.mtime;
-      mx_close_mailbox(&ctx, 0);
+      mx_mbox_close(&ctx, 0);
     }
   }
 
index 9514c11236b78cc95963baad74589c5086b27ec1..5c1d5ef5bd2baf473237f1a1834a5e44d0d03c65 100644 (file)
@@ -889,7 +889,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
   }
 #endif
 
-  if (mx_open_mailbox(buf, MUTT_APPEND, &ctx) != NULL)
+  if (mx_mbox_open(buf, MUTT_APPEND, &ctx) != NULL)
   {
 #ifdef USE_COMPRESSED
     /* If we're saving to a compressed mailbox, the stats won't be updated
@@ -905,7 +905,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
     {
       if (mutt_save_message_ctx(h, delete, decode, decrypt, &ctx) != 0)
       {
-        mx_close_mailbox(&ctx, NULL);
+        mx_mbox_close(&ctx, NULL);
         return -1;
       }
 #ifdef USE_COMPRESSED
@@ -954,14 +954,14 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
 #endif
       if (rc != 0)
       {
-        mx_close_mailbox(&ctx, NULL);
+        mx_mbox_close(&ctx, NULL);
         return -1;
       }
     }
 
     const int need_buffy_cleanup = (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF);
 
-    mx_close_mailbox(&ctx, NULL);
+    mx_mbox_close(&ctx, NULL);
 
     if (need_buffy_cleanup)
       mutt_buffy_cleanup(buf, &st);
@@ -1089,7 +1089,7 @@ static int check_traditional_pgp(struct Header *h, int *redraw)
   h->security |= PGP_TRADITIONAL_CHECKED;
 
   mutt_parse_mime_message(Context, h);
-  struct Message *msg = mx_open_message(Context, h->msgno);
+  struct Message *msg = mx_msg_open(Context, h->msgno);
   if (!msg)
     return 0;
   if (crypt_pgp_check_traditional(msg->fp, h->content, 0))
@@ -1100,7 +1100,7 @@ static int check_traditional_pgp(struct Header *h, int *redraw)
   }
 
   h->security |= PGP_TRADITIONAL_CHECKED;
-  mx_close_message(Context, &msg);
+  mx_msg_close(Context, &msg);
   return rc;
 }
 
index e446d53e292f3b0e0811eefccbd403069a2f03cc..27ef0bc68d1b9e737300a675c985ec474810b827 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1368,7 +1368,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
         menu->redraw = REDRAW_FULL;
 
-        ctx = mx_open_mailbox(fname, MUTT_READONLY, NULL);
+        ctx = mx_mbox_open(fname, MUTT_READONLY, NULL);
         if (!ctx)
         {
           mutt_error(_("Unable to open mailbox %s"), fname);
@@ -1377,7 +1377,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
         if (!ctx->msgcount)
         {
-          mx_close_mailbox(ctx, NULL);
+          mx_mbox_close(ctx, NULL);
           FREE(&ctx);
           mutt_error(_("No messages in that folder."));
           break;
@@ -1422,7 +1422,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         menu->redraw |= REDRAW_FULL;
 
         if (close == OP_QUIT)
-          mx_close_mailbox(Context, NULL);
+          mx_mbox_close(Context, NULL);
         else
           mx_fastclose_mailbox(Context);
         FREE(&Context);
index c6a7484bc73a8dcbbecd2f783f554d0ad5f25dbc..0af613a02a3a77c5fc71811fa0e952031e0bf91b 100644 (file)
@@ -667,7 +667,7 @@ static int comp_mbox_close(struct Context *ctx)
  *
  * If the mailbox has been changed in NeoMutt, warn the user.
  *
- * The return codes are picked to match mx_check_mailbox().
+ * The return codes are picked to match mx_mbox_check().
  */
 static int comp_mbox_check(struct Context *ctx, int *index_hint)
 {
diff --git a/copy.c b/copy.c
index 51fbc951ca067d16e2a189991454c25bbaf5e473..f1d0ece287bb1a2040dceb37d12d99c20d866c8d 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -786,7 +786,7 @@ int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Header *hdr, int flags,
 int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr,
                           int flags, int chflags)
 {
-  struct Message *msg = mx_open_message(src, hdr->msgno);
+  struct Message *msg = mx_msg_open(src, hdr->msgno);
   if (!msg)
     return -1;
   if (!hdr->content)
@@ -797,7 +797,7 @@ int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr,
     mutt_debug(1, "failed to detect EOF!\n");
     r = -1;
   }
-  mx_close_message(src, &msg);
+  mx_msg_close(src, &msg);
   return r;
 }
 
@@ -824,14 +824,14 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src,
   if (fgets(buf, sizeof(buf), fpin) == NULL)
     return -1;
 
-  msg = mx_open_new_message(dest, hdr, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
+  msg = mx_msg_open_new(dest, hdr, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
   if (!msg)
     return -1;
   if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF)
     chflags |= CH_FROM | CH_FORCE_FROM;
   chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
   r = mutt_copy_message_fp(msg->fp, fpin, hdr, flags, chflags);
-  if (mx_commit_message(dest, msg) != 0)
+  if (mx_msg_commit(dest, msg) != 0)
     r = -1;
 
 #ifdef USE_NOTMUCH
@@ -839,7 +839,7 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src,
     nm_update_filename(src, NULL, msg->commited_path, hdr);
 #endif
 
-  mx_close_message(dest, &msg);
+  mx_msg_close(dest, &msg);
   return r;
 }
 
@@ -856,11 +856,11 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src,
 int mutt_append_message(struct Context *dest, struct Context *src,
                         struct Header *hdr, int cmflags, int chflags)
 {
-  struct Message *msg = mx_open_message(src, hdr->msgno);
+  struct Message *msg = mx_msg_open(src, hdr->msgno);
   if (!msg)
     return -1;
   int r = append_message(dest, msg->fp, src, hdr, cmflags, chflags);
-  mx_close_message(src, &msg);
+  mx_msg_close(src, &msg);
   return r;
 }
 
index 2857a3492aff4f60c58c43f710977ad233d546b1..671ae275595309f41840c74c4ab4f6a059cb00a9 100644 (file)
@@ -456,7 +456,7 @@ static int main_change_folder(struct Menu *menu, int op, char *buf,
       new_last_folder = mutt_str_strdup(Context->path);
     *oldcount = Context ? Context->msgcount : 0;
 
-    int check = mx_close_mailbox(Context, index_hint);
+    int check = mx_mbox_close(Context, index_hint);
     if (check != 0)
     {
       if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED)
@@ -485,7 +485,7 @@ static int main_change_folder(struct Menu *menu, int op, char *buf,
    * switch statement would need to be run. */
   mutt_folder_hook(buf);
 
-  Context = mx_open_mailbox(
+  Context = mx_mbox_open(
       buf, (ReadOnly || (op == OP_MAIN_CHANGE_FOLDER_READONLY)) ? MUTT_READONLY : 0, NULL);
   if (Context)
   {
@@ -901,7 +901,7 @@ int mutt_index_menu(void)
               CURHDR->index :
               0;
 
-      check = mx_check_mailbox(Context, &index_hint);
+      check = mx_mbox_check(Context, &index_hint);
       if (check < 0)
       {
         if (!Context->path)
@@ -1509,7 +1509,7 @@ int mutt_index_menu(void)
 
           mutt_startup_shutdown_hook(MUTT_SHUTDOWNHOOK);
 
-          if (!Context || (check = mx_close_mailbox(Context, &index_hint)) == 0)
+          if (!Context || (check = mx_mbox_close(Context, &index_hint)) == 0)
             done = true;
           else
           {
@@ -1649,7 +1649,7 @@ int mutt_index_menu(void)
       case OP_MAIN_IMAP_LOGOUT_ALL:
         if (Context && Context->magic == MUTT_IMAP)
         {
-          if (mx_close_mailbox(Context, &index_hint) != 0)
+          if (mx_mbox_close(Context, &index_hint) != 0)
           {
             OptSearchInvalid = true;
             menu->redraw = REDRAW_FULL;
@@ -1691,7 +1691,7 @@ int mutt_index_menu(void)
               newhdr = Context->hdrs[Context->v2r[newidx]];
           }
 
-          check = mx_sync_mailbox(Context, &index_hint);
+          check = mx_mbox_sync(Context, &index_hint);
           if (check == 0)
           {
             if (newhdr && Context->vcount != ovc)
@@ -1711,7 +1711,7 @@ int mutt_index_menu(void)
             update_index(menu, Context, check, oc, index_hint);
 
           /*
-           * do a sanity check even if mx_sync_mailbox failed.
+           * do a sanity check even if mx_mbox_sync failed.
            */
 
           if (menu->current < 0 || menu->current >= Context->vcount)
@@ -1807,7 +1807,7 @@ int mutt_index_menu(void)
         char *tags = NULL;
         if (!tag)
           tags = driver_tags_get_with_hidden(&CURHDR->tags);
-        rc = mx_tags_editor(Context, tags, buf, sizeof(buf));
+        rc = mx_tags_edit(Context, tags, buf, sizeof(buf));
         FREE(&tags);
         if (rc < 0)
           break;
index f3aaa62f5153a4d926400761610910ea6a87d2a1..dd40e0c67e23938b9eb8bb4e14a6aed6abb8e628 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -82,7 +82,7 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
   omagic = MboxType;
   MboxType = MUTT_MBOX;
 
-  rc = (mx_open_mailbox(tmp, MUTT_NEWFOLDER, &tmpctx) == NULL) ? -1 : 0;
+  rc = (mx_mbox_open(tmp, MUTT_NEWFOLDER, &tmpctx) == NULL) ? -1 : 0;
 
   MboxType = omagic;
 
@@ -97,7 +97,7 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
       CH_NOLEN | ((ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS));
   oerrno = errno;
 
-  mx_close_mailbox(&tmpctx, NULL);
+  mx_mbox_close(&tmpctx, NULL);
 
   if (rc == -1)
   {
@@ -184,7 +184,7 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
     goto bail;
   }
 
-  if (mx_open_mailbox(ctx->path, MUTT_APPEND, &tmpctx) == NULL)
+  if (mx_mbox_open(ctx->path, MUTT_APPEND, &tmpctx) == NULL)
   {
     rc = -1;
     /* L10N: %s is from strerror(errno) */
@@ -209,14 +209,14 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
   o_read = cur->read;
   o_old = cur->old;
   cur->read = cur->old = false;
-  msg = mx_open_new_message(&tmpctx, cur, of);
+  msg = mx_msg_open_new(&tmpctx, cur, of);
   cur->read = o_read;
   cur->old = o_old;
 
   if (!msg)
   {
     mutt_error(_("Can't append to folder: %s"), strerror(errno));
-    mx_close_mailbox(&tmpctx, NULL);
+    mx_mbox_close(&tmpctx, NULL);
     goto bail;
   }
 
@@ -227,10 +227,10 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
     mutt_file_copy_stream(fp, msg->fp);
   }
 
-  rc = mx_commit_message(&tmpctx, msg);
-  mx_close_message(&tmpctx, &msg);
+  rc = mx_msg_commit(&tmpctx, msg);
+  mx_msg_close(&tmpctx, &msg);
 
-  mx_close_mailbox(&tmpctx, NULL);
+  mx_mbox_close(&tmpctx, NULL);
 
 bail:
   if (fp)
index d851551634cf4482aaf8398184284cba7c6d5ea4..7d408d7b58eaa46dd45dbed67a1712c2a9df2d5e 100644 (file)
@@ -2262,7 +2262,7 @@ static int imap_mbox_close(struct Context *ctx)
   {
     if (idata->status != IMAP_FATAL && idata->state >= IMAP_SELECTED)
     {
-      /* mx_close_mailbox won't sync if there are no deleted messages
+      /* mx_mbox_close won't sync if there are no deleted messages
        * and the mailbox is unchanged, so we may have to close here */
       if (!ctx->deleted)
         imap_exec(idata, "CLOSE", IMAP_CMD_QUEUE);
@@ -2427,7 +2427,7 @@ int imap_sync_mailbox(struct Context *ctx, int expunge)
                               "Saving changed messages... [%d/%d]", ctx->msgcount),
                      i + 1, ctx->msgcount);
         if (!appendctx)
-          appendctx = mx_open_mailbox(ctx->path, MUTT_APPEND | MUTT_QUIET, NULL);
+          appendctx = mx_mbox_open(ctx->path, MUTT_APPEND | MUTT_QUIET, NULL);
         if (!appendctx)
           mutt_debug(1, "Error opening mailbox in append mode\n");
         else
index 2b361e44392dbe176522112380b25b228f021d8c..ffe51fa0093a7fd32910430e5012cf0b5851e6db 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -42,12 +42,12 @@ struct Context;
 #define MUTT_APPENDNEW (1 << 6) /**< set in mx_open_mailbox_append if the mailbox doesn't
                                  * exist. used by maildir/mh to create the mailbox. */
 
-/* mx_open_new_message() */
+/* mx_msg_open_new() */
 #define MUTT_ADD_FROM  (1 << 0) /**< add a From_ line */
 #define MUTT_SET_DRAFT (1 << 1) /**< set the message draft flag */
 
 /**
- * enum MxCheckReturns - Return values from mx_check_mailbox()
+ * enum MxCheckReturns - Return values from mx_mbox_check()
  */
 enum MxCheckReturns
 {
@@ -64,7 +64,7 @@ struct Message
 {
   FILE *fp;            /**< pointer to the message data */
   char *path;          /**< path to temp file */
-  char *commited_path; /**< the final path generated by mx_commit_message() */
+  char *commited_path; /**< the final path generated by mx_msg_commit() */
   bool write;          /**< nonzero if message is open for writing */
   struct
   {
@@ -76,20 +76,22 @@ struct Message
   time_t received; /**< the time at which this message was received */
 };
 
-struct Context *mx_open_mailbox(const char *path, int flags, struct Context *pctx);
-
-struct Message *mx_open_message(struct Context *ctx, int msgno);
-struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, int flags);
+/* The Mailbox API, see MxOps */
+struct Context *mx_mbox_open   (const char *path, int flags, struct Context *pctx);
+int             mx_mbox_check  (struct Context *ctx, int *index_hint);
+int             mx_mbox_sync   (struct Context *ctx, int *index_hint);
+int             mx_mbox_close  (struct Context *ctx, int *index_hint);
+struct Message *mx_msg_open    (struct Context *ctx, int msgno);
+struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags);
+int             mx_msg_commit  (struct Context *ctx, struct Message *msg);
+int             mx_msg_close   (struct Context *ctx, struct Message **msg);
+int             mx_tags_edit   (struct Context *ctx, const char *tags, char *buf, size_t buflen);
+int             mx_tags_commit (struct Context *ctx, struct Header *hdr, char *tags);
 
 void mx_fastclose_mailbox(struct Context *ctx);
 
-int mx_close_mailbox(struct Context *ctx, int *index_hint);
-int mx_sync_mailbox(struct Context *ctx, int *index_hint);
-int mx_commit_message(struct Context *ctx, struct Message *msg);
-int mx_close_message(struct Context *ctx, struct Message **msg);
 int mx_get_magic(const char *path);
 int mx_set_magic(const char *s);
-int mx_check_mailbox(struct Context *ctx, int *index_hint);
 #ifdef USE_IMAP
 bool mx_is_imap(const char *p);
 #endif
diff --git a/main.c b/main.c
index f9c9d4b94f1a357d06ad9a6c8105d5223c02f29a..9a0154b1f9e730719935bfba0a92e4afb4807078 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1069,7 +1069,7 @@ int main(int argc, char *argv[], char *envp[])
     mutt_startup_shutdown_hook(MUTT_STARTUPHOOK);
 
     repeat_error = true;
-    Context = mx_open_mailbox(
+    Context = mx_mbox_open(
         folder, ((flags & MUTT_RO) || ReadOnly) ? MUTT_READONLY : 0, NULL);
     if (Context || !explicit_folder)
     {
diff --git a/mh.c b/mh.c
index a25764739256d3c2dcaa94547209adadc03f2621..b6be89bdb5c12cf4e05a74a35115526348afbe3f 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -1585,7 +1585,7 @@ static int maildir_msg_open_new(struct Context *ctx, struct Message *msg,
  *
  * hdr is a header structure to which we write the message's new
  * file name.  This is used in the mh and maildir folder synch
- * routines.  When this routine is invoked from mx_commit_message(),
+ * routines.  When this routine is invoked from mx_msg_commit(),
  * hdr is NULL.
  *
  * msg->path looks like this:
@@ -1782,7 +1782,7 @@ static int mh_rewrite_message(struct Context *ctx, int msgno)
   long old_body_length = h->content->length;
   long old_hdr_lines = h->lines;
 
-  struct Message *dest = mx_open_new_message(ctx, h, 0);
+  struct Message *dest = mx_msg_open_new(ctx, h, 0);
   if (!dest)
     return -1;
 
@@ -1799,7 +1799,7 @@ static int mh_rewrite_message(struct Context *ctx, int msgno)
     else
       rc = mh_commit_msg(ctx, dest, h, 0);
 
-    mx_close_message(ctx, &dest);
+    mx_msg_close(ctx, &dest);
 
     if (rc == 0)
     {
@@ -1832,7 +1832,7 @@ static int mh_rewrite_message(struct Context *ctx, int msgno)
     }
   }
   else
-    mx_close_message(ctx, &dest);
+    mx_msg_close(ctx, &dest);
 
   if (rc == -1 && restore)
   {
@@ -2069,7 +2069,7 @@ static int maildir_mbox_check(struct Context *ctx, int *index_hint)
                                    for a maildir message */
   struct MhData *data = mh_data(ctx);
 
-  /* XXX seems like this check belongs in mx_check_mailbox()
+  /* XXX seems like this check belongs in mx_mbox_check()
    * rather than here.
    */
   if (!CheckNew)
diff --git a/mx.c b/mx.c
index e14fa40e65ebff4baff983af394f737c1264f8f6..b25d61c4328d127f244a6d56abfb962f09342432 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -418,7 +418,7 @@ static int mx_open_mailbox_append(struct Context *ctx, int flags)
 }
 
 /**
- * mx_open_mailbox - Open a mailbox and parse it
+ * mx_mbox_open - Open a mailbox and parse it
  * @param path  Path to the mailbox
  * @param flags See below
  * @param pctx  Reuse this Context (if supplied)
@@ -432,7 +432,7 @@ static int mx_open_mailbox_append(struct Context *ctx, int flags)
  * * #MUTT_QUIET    only print error messages
  * * #MUTT_PEEK     revert atime where applicable
  */
-struct Context *mx_open_mailbox(const char *path, int flags, struct Context *pctx)
+struct Context *mx_mbox_open(const char *path, int flags, struct Context *pctx)
 {
   struct Context *ctx = pctx;
   int rc;
@@ -556,7 +556,7 @@ void mx_fastclose_mailbox(struct Context *ctx)
   }
 
   /* never announce that a mailbox we've just left has new mail. #3290
-   * TODO: really belongs in mx_close_mailbox, but this is a nice hook point */
+   * TODO: really belongs in mx_mbox_close, but this is a nice hook point */
   if (!ctx->peekonly)
     mutt_buffy_setnotified(ctx->path);
 
@@ -653,7 +653,7 @@ static int trash_append(struct Context *ctx)
   }
 #endif
 
-  if (mx_open_mailbox(Trash, MUTT_APPEND, &ctx_trash) != NULL)
+  if (mx_mbox_open(Trash, MUTT_APPEND, &ctx_trash) != NULL)
   {
     /* continue from initial scan above */
     for (; i < ctx->msgcount; i++)
@@ -662,13 +662,13 @@ static int trash_append(struct Context *ctx)
       {
         if (mutt_append_message(&ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
         {
-          mx_close_mailbox(&ctx_trash, NULL);
+          mx_mbox_close(&ctx_trash, NULL);
           return -1;
         }
       }
     }
 
-    mx_close_mailbox(&ctx_trash, NULL);
+    mx_mbox_close(&ctx_trash, NULL);
   }
   else
   {
@@ -680,13 +680,13 @@ static int trash_append(struct Context *ctx)
 }
 
 /**
- * mx_close_mailbox - save changes and close mailbox
+ * mx_mbox_close - save changes and close mailbox
  * @param ctx        Mailbox
  * @param index_hint Current email
  * @retval  0 Success
  * @retval -1 Failure
  */
-int mx_close_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_close(struct Context *ctx, int *index_hint)
 {
   int i, move_messages = 0, purge = 1, read_msgs = 0;
   struct Context f;
@@ -834,7 +834,7 @@ int mx_close_mailbox(struct Context *ctx, int *index_hint)
     else /* use regular append-copy mode */
 #endif
     {
-      if (mx_open_mailbox(mbox, MUTT_APPEND, &f) == NULL)
+      if (mx_mbox_open(mbox, MUTT_APPEND, &f) == NULL)
       {
         ctx->closing = false;
         return -1;
@@ -852,14 +852,14 @@ int mx_close_mailbox(struct Context *ctx, int *index_hint)
           }
           else
           {
-            mx_close_mailbox(&f, NULL);
+            mx_mbox_close(&f, NULL);
             ctx->closing = false;
             return -1;
           }
         }
       }
 
-      mx_close_mailbox(&f, NULL);
+      mx_mbox_close(&f, NULL);
     }
   }
   else if (!ctx->changed && ctx->deleted == 0)
@@ -1028,9 +1028,9 @@ void mx_update_tables(struct Context *ctx, bool committing)
       if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
         mutt_hash_delete(ctx->id_hash, ctx->hdrs[i]->env->message_id, ctx->hdrs[i]);
       mutt_label_hash_remove(ctx, ctx->hdrs[i]);
-      /* The path mx_check_mailbox() -> imap_check_mailbox() ->
+      /* The path mx_mbox_check() -> imap_check_mailbox() ->
        *          imap_expunge_mailbox() -> mx_update_tables()
-       * can occur before a call to mx_sync_mailbox(), resulting in
+       * 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 == ctx->hdrs[i])
@@ -1042,13 +1042,13 @@ void mx_update_tables(struct Context *ctx, bool committing)
 }
 
 /**
- * mx_sync_mailbox - Save changes to mailbox
+ * mx_mbox_sync - Save changes to mailbox
  * @param[in]  ctx        Context
  * @param[out] index_hint Currently selected mailbox
  * @retval  0 Success
  * @retval -1 Error
  */
-int mx_sync_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_sync(struct Context *ctx, int *index_hint)
 {
   int rc;
   int purge = 1;
@@ -1171,20 +1171,20 @@ int mx_sync_mailbox(struct Context *ctx, int *index_hint)
 }
 
 /**
- * mx_open_new_message - Open a new message
- * @param dest  Destination mailbox
+ * mx_msg_open_new - Open a new message
+ * @param ctx   Destination mailbox
  * @param hdr   Message being copied (required for maildir support, because the filename depends on the message flags)
  * @param flags Flags, e.g. #MUTT_SET_DRAFT
  * @retval ptr New Message
  */
-struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, int flags)
+struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags)
 {
   struct Address *p = NULL;
   struct Message *msg = NULL;
 
-  if (!dest->mx_ops || !dest->mx_ops->msg_open_new)
+  if (!ctx->mx_ops || !ctx->mx_ops->msg_open_new)
   {
-    mutt_debug(1, "function unimplemented for mailbox type %d.\n", dest->magic);
+    mutt_debug(1, "function unimplemented for mailbox type %d.\n", ctx->magic);
     return NULL;
   }
 
@@ -1203,12 +1203,12 @@ struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, in
   if (msg->received == 0)
     time(&msg->received);
 
-  if (dest->mx_ops->msg_open_new(dest, msg, hdr) == 0)
+  if (ctx->mx_ops->msg_open_new(ctx, msg, hdr) == 0)
   {
-    if (dest->magic == MUTT_MMDF)
+    if (ctx->magic == MUTT_MMDF)
       fputs(MMDF_SEP, msg->fp);
 
-    if ((dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) && flags & MUTT_ADD_FROM)
+    if ((ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) && flags & MUTT_ADD_FROM)
     {
       if (hdr)
       {
@@ -1231,14 +1231,14 @@ struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, in
 }
 
 /**
- * mx_check_mailbox - check for new mail
+ * mx_mbox_check - check for new mail
  * @param ctx        Mailbox
  * @param index_hint Current email
  * @retval >0 Success, e.g. #MUTT_NEW_MAIL
  * @retval  0 Success, no change
  * @retval -1 Failure
  */
-int mx_check_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_check(struct Context *ctx, int *index_hint)
 {
   if (!ctx || !ctx->mx_ops)
   {
@@ -1250,13 +1250,13 @@ int mx_check_mailbox(struct Context *ctx, int *index_hint)
 }
 
 /**
- * mx_open_message - return a stream pointer for a message
+ * mx_msg_open - return a stream pointer for a message
  * @param ctx   Mailbox
  * @param msgno Message number
  * @retval ptr  Message
  * @retval NULL Error
  */
-struct Message *mx_open_message(struct Context *ctx, int msgno)
+struct Message *mx_msg_open(struct Context *ctx, int msgno)
 {
   struct Message *msg = NULL;
 
@@ -1274,13 +1274,13 @@ struct Message *mx_open_message(struct Context *ctx, int msgno)
 }
 
 /**
- * mx_commit_message - commit a message to a folder
+ * mx_msg_commit - commit a message to a folder
  * @param msg Message to commit
  * @param ctx Mailbox
  * @retval  0 Success
  * @retval -1 Failure
  */
-int mx_commit_message(struct Context *ctx, struct Message *msg)
+int mx_msg_commit(struct Context *ctx, struct Message *msg)
 {
   if (!ctx->mx_ops || !ctx->mx_ops->msg_commit)
     return -1;
@@ -1295,13 +1295,13 @@ int mx_commit_message(struct Context *ctx, struct Message *msg)
 }
 
 /**
- * mx_close_message - Close a message
+ * mx_msg_close - Close a message
  * @param ctx Mailbox
  * @param msg Message to close
  * @retval  0 Success
  * @retval -1 Failure
  */
-int mx_close_message(struct Context *ctx, struct Message **msg)
+int mx_msg_close(struct Context *ctx, struct Message **msg)
 {
   if (!ctx || !msg || !*msg)
     return 0;
@@ -1450,7 +1450,7 @@ int mx_check_empty(const char *path)
 }
 
 /**
- * mx_tags_editor - start the tag editor of the mailbox
+ * mx_tags_edit - start the tag editor of the mailbox
  * @param ctx    Mailbox
  * @param tags   Existing tags
  * @param buf    Buffer for the results
@@ -1459,7 +1459,7 @@ int mx_check_empty(const char *path)
  * @retval 0  No valid user input
  * @retval 1  Buffer set
  */
-int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen)
+int mx_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t buflen)
 {
   if (ctx->mx_ops->tags_edit)
     return ctx->mx_ops->tags_edit(ctx, tags, buf, buflen);
@@ -1471,15 +1471,15 @@ int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t bufl
 /**
  * mx_tags_commit - save tags to the mailbox
  * @param ctx  Mailbox
- * @param h    Email Header
+ * @param hdr  Email Header
  * @param tags Tags to save
  * @retval  0 Success
  * @retval -1 Failure
  */
-int mx_tags_commit(struct Context *ctx, struct Header *h, char *tags)
+int mx_tags_commit(struct Context *ctx, struct Header *hdr, char *tags)
 {
   if (ctx->mx_ops->tags_commit)
-    return ctx->mx_ops->tags_commit(ctx, h, tags);
+    return ctx->mx_ops->tags_commit(ctx, hdr, tags);
 
   mutt_message(_("Folder doesn't support tagging, aborting."));
   return -1;
diff --git a/mx.h b/mx.h
index 1b1f3edeae42de6d614241b85bd80bb6c42426b7..0bd293f39df4355035798c231c29c5e33409bd12 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -178,8 +178,6 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno);
 bool mx_is_notmuch(const char *p);
 #endif
 
-int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen);
-int mx_tags_commit(struct Context *ctx, struct Header *h, char *tags);
 bool mx_tags_is_supported(struct Context *ctx);
 
 FILE *maildir_open_find_message(const char *folder, const char *msg, char **newname);
diff --git a/pager.c b/pager.c
index 82714d3ed9fdeb4ed20752555a79247c7d02279c..373e47588503b5409afb3457f6df40a9d2e4cf1f 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2204,7 +2204,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
     {
       oldcount = Context ? Context->msgcount : 0;
       /* check for new mail */
-      check = mx_check_mailbox(Context, &index_hint);
+      check = mx_mbox_check(Context, &index_hint);
       if (check < 0)
       {
         if (!Context->path)
diff --git a/parse.c b/parse.c
index 8216418234946327c691f208115a2cb4a212327f..f6710c4557278deb63b9a6f089c3ef2d315e6818 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -760,7 +760,7 @@ void mutt_parse_mime_message(struct Context *ctx, struct Header *cur)
     if (cur->content->parts)
       break; /* The message was parsed earlier. */
 
-    msg = mx_open_message(ctx, cur->msgno);
+    msg = mx_msg_open(ctx, cur->msgno);
     if (msg)
     {
       mutt_parse_part(msg->fp, cur->content);
@@ -768,7 +768,7 @@ void mutt_parse_mime_message(struct Context *ctx, struct Header *cur)
       if (WithCrypto)
         cur->security = crypt_query(cur->content);
 
-      mx_close_message(ctx, &msg);
+      mx_msg_close(ctx, &msg);
     }
   } while (0);
 
index 40022cc0c37b9ecd5683cab8164174e1177964be..e330600e4d66527cef009f70a745e3e7cbaed2b8 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -891,7 +891,7 @@ static int patmatch(const struct Pattern *pat, const char *buf)
 static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
 {
   int match = 0;
-  struct Message *msg = mx_open_message(ctx, msgno);
+  struct Message *msg = mx_msg_open(ctx, msgno);
   if (!msg)
   {
     return match;
@@ -939,7 +939,7 @@ static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
 
       if ((WithCrypto != 0) && (h->security & ENCRYPT) && !crypt_valid_passphrase(h->security))
       {
-        mx_close_message(ctx, &msg);
+        mx_msg_close(ctx, &msg);
         if (s.fpout)
         {
           mutt_file_fclose(&s.fpout);
@@ -1025,7 +1025,7 @@ static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
 
   FREE(&buf);
 
-  mx_close_message(ctx, &msg);
+  mx_msg_close(ctx, &msg);
 
   if (ThoroughSearch)
   {
diff --git a/pop.c b/pop.c
index 1022803149c97167411bbf641591ce4503b23d05..a88f1783bef301294b1c8e31574f2fc97734fc9f 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -946,7 +946,7 @@ void pop_fetch_mail(void)
     goto finish;
   }
 
-  if (mx_open_mailbox(NONULL(Spoolfile), MUTT_APPEND, &ctx) == NULL)
+  if (mx_mbox_open(NONULL(Spoolfile), MUTT_APPEND, &ctx) == NULL)
     goto finish;
 
   delanswer = query_quadoption(PopDelete, _("Delete messages from server?"));
@@ -959,7 +959,7 @@ void pop_fetch_mail(void)
 
   for (int i = last + 1; i <= msgs; i++)
   {
-    msg = mx_open_new_message(&ctx, NULL, MUTT_ADD_FROM);
+    msg = mx_msg_open_new(&ctx, NULL, MUTT_ADD_FROM);
     if (!msg)
       ret = -3;
     else
@@ -969,13 +969,13 @@ void pop_fetch_mail(void)
       if (ret == -3)
         rset = 1;
 
-      if (ret == 0 && mx_commit_message(&ctx, msg) != 0)
+      if (ret == 0 && mx_msg_commit(&ctx, msg) != 0)
       {
         rset = 1;
         ret = -3;
       }
 
-      mx_close_message(&ctx, &msg);
+      mx_msg_close(&ctx, &msg);
     }
 
     if (ret == 0 && delanswer == MUTT_YES)
@@ -987,7 +987,7 @@ void pop_fetch_mail(void)
 
     if (ret == -1)
     {
-      mx_close_mailbox(&ctx, NULL);
+      mx_mbox_close(&ctx, NULL);
       goto fail;
     }
     if (ret == -2)
@@ -1008,7 +1008,7 @@ void pop_fetch_mail(void)
                  msgbuf, i - last, msgs - last);
   }
 
-  mx_close_mailbox(&ctx, NULL);
+  mx_mbox_close(&ctx, NULL);
 
   if (rset)
   {
index 87e478f89ec0792f7ed3ffc8aef9259f46b49ca5..8b0cd255f8f52f5630912cc2acc1bd6bd6e05db2 100644 (file)
@@ -158,7 +158,7 @@ int mutt_num_postponed(int force)
     if (optnews)
       OptNews = false;
 #endif
-    if (mx_open_mailbox(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx) == NULL)
+    if (mx_mbox_open(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx) == NULL)
       PostCount = 0;
     else
       PostCount = ctx.msgcount;
@@ -285,7 +285,7 @@ int mutt_get_postponed(struct Context *ctx, struct Header *hdr,
   if (!Postponed)
     return -1;
 
-  PostContext = mx_open_mailbox(Postponed, MUTT_NOSORT, NULL);
+  PostContext = mx_mbox_open(Postponed, MUTT_NOSORT, NULL);
   if (!PostContext)
   {
     PostCount = 0;
@@ -296,7 +296,7 @@ int mutt_get_postponed(struct Context *ctx, struct Header *hdr,
   if (!PostContext->msgcount)
   {
     PostCount = 0;
-    mx_close_mailbox(PostContext, NULL);
+    mx_mbox_close(PostContext, NULL);
     FREE(&PostContext);
     mutt_error(_("No postponed messages."));
     return -1;
@@ -309,7 +309,7 @@ int mutt_get_postponed(struct Context *ctx, struct Header *hdr,
   }
   else if ((h = select_msg()) == NULL)
   {
-    mx_close_mailbox(PostContext, NULL);
+    mx_mbox_close(PostContext, NULL);
     FREE(&PostContext);
     return -1;
   }
@@ -331,7 +331,7 @@ int mutt_get_postponed(struct Context *ctx, struct Header *hdr,
   /* avoid the "purge deleted messages" prompt */
   opt_delete = Delete;
   Delete = MUTT_YES;
-  mx_close_mailbox(PostContext, NULL);
+  mx_mbox_close(PostContext, NULL);
   Delete = opt_delete;
 
   FREE(&PostContext);
@@ -562,7 +562,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr,
 
   memset(&s, 0, sizeof(s));
 
-  if (!fp && (msg = mx_open_message(ctx, hdr->msgno)) == NULL)
+  if (!fp && (msg = mx_msg_open(ctx, hdr->msgno)) == NULL)
     return -1;
 
   if (!fp)
@@ -773,7 +773,7 @@ bail:
   if (bfp != fp)
     mutt_file_fclose(&bfp);
   if (msg)
-    mx_close_message(ctx, &msg);
+    mx_msg_close(ctx, &msg);
 
   if (rc == -1)
   {
index 2d0e5d6c265ec5812ccf023a9dde066872575165..ed775c093a56bc56f708d09edaf26348926c3f54 100644 (file)
@@ -1177,7 +1177,7 @@ void mutt_view_attachments(struct Header *hdr)
 
   mutt_message_hook(Context, hdr, MUTT_MESSAGEHOOK);
 
-  struct Message *msg = mx_open_message(Context, hdr->msgno);
+  struct Message *msg = mx_msg_open(Context, hdr->msgno);
   if (!msg)
     return;
 
@@ -1427,7 +1427,7 @@ void mutt_view_attachments(struct Header *hdr)
         break;
 
       case OP_EXIT:
-        mx_close_message(Context, &msg);
+        mx_msg_close(Context, &msg);
 
         hdr->attach_del = false;
         for (int i = 0; i < actx->idxlen; i++)
index d62ae9930d2b6006ac36900e9d0a1a823b0de794..b6ccdbddd46513a14a405741fe0794dd1c36c223 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -2722,7 +2722,7 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to,
   }
 
   /* If we failed to open a message, return with error */
-  if (!fp && (msg = mx_open_message(Context, h->msgno)) == NULL)
+  if (!fp && (msg = mx_msg_open(Context, h->msgno)) == NULL)
     return -1;
 
   if (!fp)
@@ -2766,7 +2766,7 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to,
   }
 
   if (msg)
-    mx_close_message(Context, &msg);
+    mx_msg_close(Context, &msg);
 
   return rc;
 }
@@ -2942,7 +2942,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
 #ifdef RECORD_FOLDER_HOOK
   mutt_folder_hook(path);
 #endif
-  if (mx_open_mailbox(path, MUTT_APPEND | MUTT_QUIET, &f) == NULL)
+  if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &f) == NULL)
   {
     mutt_debug(1, "unable to open mailbox %s in append-mode, aborting.\n", path);
     goto done;
@@ -2958,7 +2958,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
     if (!tempfp)
     {
       mutt_perror(tempfile);
-      mx_close_mailbox(&f, NULL);
+      mx_mbox_close(&f, NULL);
       goto done;
     }
     /* remember new mail status before appending message */
@@ -2970,11 +2970,11 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
   onm_flags = MUTT_ADD_FROM;
   if (post)
     onm_flags |= MUTT_SET_DRAFT;
-  msg = mx_open_new_message(&f, hdr, onm_flags);
+  msg = mx_msg_open_new(&f, hdr, onm_flags);
   if (!msg)
   {
     mutt_file_fclose(&tempfp);
-    mx_close_mailbox(&f, NULL);
+    mx_mbox_close(&f, NULL);
     goto done;
   }
 
@@ -3090,9 +3090,9 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
       mutt_debug(1, "%s: write failed.\n", tempfile);
       mutt_file_fclose(&tempfp);
       unlink(tempfile);
-      mx_commit_message(&f, msg); /* XXX - really? */
-      mx_close_message(&f, &msg);
-      mx_close_mailbox(&f, NULL);
+      mx_msg_commit(&f, msg); /* XXX - really? */
+      mx_msg_close(&f, &msg);
+      mx_mbox_close(&f, NULL);
       goto done;
     }
 
@@ -3118,12 +3118,12 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
     rc = mutt_write_mime_body(hdr->content, msg->fp);
   }
 
-  if (mx_commit_message(&f, msg) != 0)
+  if (mx_msg_commit(&f, msg) != 0)
     rc = -1;
   else if (finalpath)
     *finalpath = mutt_str_strdup(msg->commited_path);
-  mx_close_message(&f, &msg);
-  mx_close_mailbox(&f, NULL);
+  mx_msg_close(&f, &msg);
+  mx_mbox_close(&f, NULL);
 
   if (!post && need_buffy_cleanup)
     mutt_buffy_cleanup(path, &st);