]> granicus.if.org Git - neomutt/commitdiff
mx api: unify parameter naming
authorRichard Russon <rich@flatcap.org>
Tue, 5 Jun 2018 19:10:34 +0000 (20:10 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 6 Jun 2018 12:30:02 +0000 (13:30 +0100)
compress.c
imap/imap.c
mbox.c
mh.c
mx.c
mx.h

index 6e546a0357013d0fd13ad461505bf13d12418d06..4dd63a0c2bf4b9995625e6399732883a0fb7b423 100644 (file)
@@ -784,13 +784,13 @@ static int comp_commit_message(struct Context *ctx, struct Message *msg)
 
 /**
  * comp_open_new_message - Delegated to mbox handler
- * @param msg Message to commit
  * @param ctx Mailbox
+ * @param msg Message to commit
  * @param hdr Email header
  * @retval  0 Success
  * @retval -1 Failure
  */
-static int comp_open_new_message(struct Message *msg, struct Context *ctx, struct Header *hdr)
+static int comp_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
 {
   if (!ctx)
     return -1;
@@ -804,7 +804,7 @@ static int comp_open_new_message(struct Message *msg, struct Context *ctx, struc
     return -1;
 
   /* Delegate */
-  return ops->open_new_msg(msg, ctx, hdr);
+  return ops->open_new_msg(ctx, msg, hdr);
 }
 
 /**
index 9353a94f6980e9038600e4aa9ecdc6bd84409e81..ad25b27d0d0449ba2b2f7c6576124cfc26e7e0bc 100644 (file)
@@ -2312,13 +2312,13 @@ static int imap_close_mailbox(struct Context *ctx)
 
 /**
  * imap_open_new_message - Open an IMAP message
+ * @param ctx  Context (UNUSED)
  * @param msg  Message to open
- * @param dest Context (UNUSED)
  * @param hdr  Header (UNUSED)
  * @retval  0 Success
  * @retval -1 Failure
  */
-static int imap_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int imap_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
 {
   char tmp[_POSIX_PATH_MAX];
 
@@ -2640,9 +2640,9 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b
 
 /**
  * imap_commit_message_tags - Add/Change/Remove flags from headers
- * @param ctx  Context
- * @param h    Header
- * @param tags List of tags
+ * @param ctx Context
+ * @param hdr Header
+ * @param buf List of tags
  * @retval  0 Success
  * @retval -1 Error
  *
@@ -2656,23 +2656,23 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b
  * Also this method check that each flags is support by the server
  * first and remove unsupported one.
  */
-static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char *tags)
+static int imap_commit_message_tags(struct Context *ctx, struct Header *hdr, char *buf)
 {
   struct Buffer *cmd = NULL;
   char uid[11];
 
   struct ImapData *idata = ctx->data;
 
-  if (*tags == '\0')
-    tags = NULL;
+  if (*buf == '\0')
+    buf = NULL;
 
   if (!mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE))
     return 0;
 
-  snprintf(uid, sizeof(uid), "%u", HEADER_DATA(h)->uid);
+  snprintf(uid, sizeof(uid), "%u", HEADER_DATA(hdr)->uid);
 
   /* Remove old custom flags */
-  if (HEADER_DATA(h)->flags_remote)
+  if (HEADER_DATA(hdr)->flags_remote)
   {
     cmd = mutt_buffer_new();
     if (!cmd)
@@ -2684,7 +2684,7 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char
     mutt_buffer_addstr(cmd, "UID STORE ");
     mutt_buffer_addstr(cmd, uid);
     mutt_buffer_addstr(cmd, " -FLAGS.SILENT (");
-    mutt_buffer_addstr(cmd, HEADER_DATA(h)->flags_remote);
+    mutt_buffer_addstr(cmd, HEADER_DATA(hdr)->flags_remote);
     mutt_buffer_addstr(cmd, ")");
 
     /* Should we return here, or we are fine and we could
@@ -2700,7 +2700,7 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char
   }
 
   /* Add new custom flags */
-  if (tags)
+  if (buf)
   {
     cmd = mutt_buffer_new();
     if (!cmd)
@@ -2712,7 +2712,7 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char
     mutt_buffer_addstr(cmd, "UID STORE ");
     mutt_buffer_addstr(cmd, uid);
     mutt_buffer_addstr(cmd, " +FLAGS.SILENT (");
-    mutt_buffer_addstr(cmd, tags);
+    mutt_buffer_addstr(cmd, buf);
     mutt_buffer_addstr(cmd, ")");
 
     if (imap_exec(idata, cmd->data, 0) != 0)
@@ -2726,10 +2726,10 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char
   }
 
   /* We are good sync them */
-  mutt_debug(1, "NEW TAGS: %d\n", tags);
-  driver_tags_replace(&h->tags, tags);
-  FREE(&HEADER_DATA(h)->flags_remote);
-  HEADER_DATA(h)->flags_remote = driver_tags_get_with_hidden(&h->tags);
+  mutt_debug(1, "NEW TAGS: %d\n", buf);
+  driver_tags_replace(&hdr->tags, buf);
+  FREE(&HEADER_DATA(hdr)->flags_remote);
+  HEADER_DATA(hdr)->flags_remote = driver_tags_get_with_hidden(&hdr->tags);
   return 0;
 }
 
diff --git a/mbox.c b/mbox.c
index c539b191f185ddb2f29f7d68dbaa8ffd5107010e..8fda170289d7ad55a3d3179b1cae59bd9f8fdd25 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -552,9 +552,9 @@ static int mmdf_commit_message(struct Context *ctx, struct Message *msg)
   return 0;
 }
 
-static int mbox_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int mbox_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
 {
-  msg->fp = dest->fp;
+  msg->fp = ctx->fp;
   return 0;
 }
 
diff --git a/mh.c b/mh.c
index be06f5f30db92722b6c534f73749274e4ab670d0..802e3e022ed9893f62d020275f5e812c0e31c720 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -1405,9 +1405,9 @@ static int mh_open_mailbox_append(struct Context *ctx, int flags)
  * Open a new (temporary) message in an MH folder.
  */
 
-static int mh_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int mh_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
 {
-  return mh_mkstemp(dest, &msg->fp, &msg->path);
+  return mh_mkstemp(ctx, &msg->fp, &msg->path);
 }
 
 static int ch_compar(const void *a, const void *b)
@@ -1485,7 +1485,7 @@ static int mh_close_message(struct Context *ctx, struct Message *msg)
  * Note that this uses _almost_ the maildir file name format,
  * but with a {cur,new} prefix.
  */
-static int maildir_open_new_message(struct Message *msg, struct Context *dest,
+static int maildir_open_new_message(struct Context *ctx, struct Message *msg,
                                     struct Header *hdr)
 {
   int fd;
@@ -1511,10 +1511,10 @@ static int maildir_open_new_message(struct Message *msg, struct Context *dest,
   else
     mutt_str_strfcpy(subdir, "new", sizeof(subdir));
 
-  omask = umask(mh_umask(dest));
+  omask = umask(mh_umask(ctx));
   while (true)
   {
-    snprintf(path, _POSIX_PATH_MAX, "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s", dest->path, subdir,
+    snprintf(path, _POSIX_PATH_MAX, "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s", ctx->path, subdir,
              (long long) time(NULL), mutt_rand64(), NONULL(ShortHostname), suffix);
 
     mutt_debug(2, "Trying %s.\n", path);
diff --git a/mx.c b/mx.c
index 74845fb7356390c6ace6f001de1d273eed320ccf..e900d25db42ee487d93b13389ea0ffe2ca313bdf 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1203,7 +1203,7 @@ struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, in
   if (msg->received == 0)
     time(&msg->received);
 
-  if (dest->mx_ops->open_new_msg(msg, dest, hdr) == 0)
+  if (dest->mx_ops->open_new_msg(dest, msg, hdr) == 0)
   {
     if (dest->magic == MUTT_MMDF)
       fputs(MMDF_SEP, msg->fp);
diff --git a/mx.h b/mx.h
index 90f9cef38e899eaca4bcfabf17a3ede7ab6beafe..14d875f2903893b9cf8febbb1534d5565df7733d 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -57,9 +57,9 @@ struct MxOps
   int (*open_msg)(struct Context *ctx, struct Message *msg, int msgno);
   int (*close_msg)(struct Context *ctx, struct Message *msg);
   int (*commit_msg)(struct Context *ctx, struct Message *msg);
-  int (*open_new_msg)(struct Message *msg, struct Context *ctx, struct Header *hdr);
+  int (*open_new_msg)(struct Context *ctx, struct Message *msg, struct Header *hdr);
   int (*edit_msg_tags)(struct Context *ctx, const char *tags, char *buf, size_t buflen);
-  int (*commit_msg_tags)(struct Context *msg, struct Header *hdr, char *buf);
+  int (*commit_msg_tags)(struct Context *ctx, struct Header *hdr, char *buf);
 };
 
 /**