# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462475358 14400
#      Thu May 05 15:09:18 2016 -0400
# Node ID abb26608b2721d6d6a9d54ec6b60099dbc6561c8
# Parent  8bd12e036c3eb78a14e32cafd3d2da5cfbfc3fb1
mh: add mh_open_mailbox function

To be more consistent with other mailboxes, introduce a function using
the same template for the name (<type>_open_mailbox) and the same
parameters as other mailboxes.

diff -r 8bd12e036c3e -r abb26608b272 mh.c
--- a/mh.c      Thu May 05 14:11:34 2016 -0400
+++ b/mh.c      Thu May 05 15:09:18 2016 -0400
@@ -1165,6 +1165,15 @@
   .close = mh_close_mailbox,
 };
 
+int mh_open_mailbox (CONTEXT *ctx)
+{
+  int rc = mh_read_dir (ctx, NULL);
+
+  ctx->mx_ops = &mx_mh_ops;
+
+  return rc;
+}
+
 /* Read a MH/maildir style mailbox.
  *
  * args:
@@ -1192,7 +1201,6 @@
   if (!ctx->data)
   {
     ctx->data = safe_calloc(sizeof (struct mh_data), 1);
-    ctx->mx_ops = &mx_mh_ops;
   }
   data = mh_data (ctx);
 
diff -r 8bd12e036c3e -r abb26608b272 mx.c
--- a/mx.c      Thu May 05 14:11:34 2016 -0400
+++ b/mx.c      Thu May 05 15:09:18 2016 -0400
@@ -653,7 +653,7 @@
   switch (ctx->magic)
   {
     case MUTT_MH:
-      rc = mh_read_dir (ctx, NULL);
+      rc = mh_open_mailbox (ctx);
       break;
 
     case MUTT_MAILDIR:
diff -r 8bd12e036c3e -r abb26608b272 mx.h
--- a/mx.h      Thu May 05 14:11:34 2016 -0400
+++ b/mx.h      Thu May 05 15:09:18 2016 -0400
@@ -53,6 +53,7 @@
 int mbox_check_empty (const char *);
 void mbox_reset_atime (CONTEXT *, struct stat *);
 
+int mh_open_mailbox (CONTEXT *);
 int mh_read_dir (CONTEXT *, const char *);
 int mh_sync_mailbox (CONTEXT *, int *);
 int mh_check_mailbox (CONTEXT *, int *);

Reply via email to