# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462475374 14400
#      Thu May 05 15:09:34 2016 -0400
# Node ID d68a087328c13219f53944a46fad4aa8db1bc458
# Parent  abb26608b2721d6d6a9d54ec6b60099dbc6561c8
maildir: add maildir_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 abb26608b272 -r d68a087328c1 mh.c
--- a/mh.c      Thu May 05 15:09:18 2016 -0400
+++ b/mh.c      Thu May 05 15:09:34 2016 -0400
@@ -1161,10 +1161,23 @@
   return 0;
 }
 
+struct mx_ops mx_maildir_ops = {
+  .close = mh_close_mailbox,
+};
+
 struct mx_ops mx_mh_ops = {
   .close = mh_close_mailbox,
 };
 
+int maildir_open_mailbox (CONTEXT *ctx)
+{
+  int rc = maildir_read_dir (ctx);
+
+  ctx->mx_ops = &mx_maildir_ops;
+
+  return rc;
+}
+
 int mh_open_mailbox (CONTEXT *ctx)
 {
   int rc = mh_read_dir (ctx, NULL);
diff -r abb26608b272 -r d68a087328c1 mx.c
--- a/mx.c      Thu May 05 15:09:18 2016 -0400
+++ b/mx.c      Thu May 05 15:09:34 2016 -0400
@@ -657,7 +657,7 @@
       break;
 
     case MUTT_MAILDIR:
-      rc = maildir_read_dir (ctx);
+      rc = maildir_open_mailbox (ctx);
       break;
 
     case MUTT_MMDF:
diff -r abb26608b272 -r d68a087328c1 mx.h
--- a/mx.h      Thu May 05 15:09:18 2016 -0400
+++ b/mx.h      Thu May 05 15:09:34 2016 -0400
@@ -59,6 +59,7 @@
 int mh_check_mailbox (CONTEXT *, int *);
 int mh_check_empty (const char *);
 
+int maildir_open_mailbox (CONTEXT *);
 int maildir_read_dir (CONTEXT *);
 int maildir_check_mailbox (CONTEXT *, int *);
 int maildir_check_empty (const char *);

Reply via email to