# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462475358 14400
# Thu May 05 15:09:18 2016 -0400
# Node ID dc2a95980534595f3b7bbbc77006962ed11b8ff6
# Parent ee1d9e055d02d95b79ae66328ce64aa0cd61b2fd
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 ee1d9e055d02 -r dc2a95980534 mh.c
--- a/mh.c Thu May 05 14:11:34 2016 -0400
+++ b/mh.c Thu May 05 15:09:18 2016 -0400
@@ -1168,7 +1168,7 @@
* subdir [IN] NULL for MH mailboxes, otherwise the subdir of the
* maildir mailbox to read from
*/
-int mh_read_dir (CONTEXT * ctx, const char *subdir)
+static int mh_read_dir (CONTEXT * ctx, const char *subdir)
{
struct maildir *md;
struct mh_sequences mhs;
@@ -1188,7 +1188,6 @@
if (!ctx->data)
{
ctx->data = safe_calloc(sizeof (struct mh_data), 1);
- ctx->mx_ops = &mx_mh_ops;
}
data = mh_data (ctx);
@@ -1235,6 +1234,15 @@
return 0;
}
+int mh_open_mailbox (CONTEXT *ctx)
+{
+ int rc = mh_read_dir (ctx, NULL);
+
+ ctx->mx_ops = &mx_mh_ops;
+
+ return rc;
+}
+
/*
* Open a new (temporary) message in an MH folder.
*/
diff -r ee1d9e055d02 -r dc2a95980534 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 ee1d9e055d02 -r dc2a95980534 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,7 +53,7 @@
int mbox_check_empty (const char *);
void mbox_reset_atime (CONTEXT *, struct stat *);
-int mh_read_dir (CONTEXT *, const char *);
+int mh_open_mailbox (CONTEXT *);
int mh_sync_mailbox (CONTEXT *, int *);
int mh_check_mailbox (CONTEXT *, int *);
int mh_check_empty (const char *);