# HG changeset patch # User Damien Riegel <damien.rie...@gmail.com> # Date 1462475358 14400 # Thu May 05 15:09:18 2016 -0400 # Node ID c604cde6393597d2cd2e10090f289b4792d1629e # Parent ae90114e6ef33712f271cad86604e8f9c8619773 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 ae90114e6ef3 -r c604cde63935 mh.c --- a/mh.c Thu May 05 14:40:15 2016 -0400 +++ b/mh.c Thu May 05 15:09:18 2016 -0400 @@ -1181,6 +1181,18 @@ .close = mh_close_mailbox, }; +int mh_open_mailbox(CONTEXT *ctx) +{ + int rc = mh_read_dir(ctx, NULL); + + if (rc) + return rc; + + ctx->mx_ops = &mx_mh_ops; + + return 0; +} + /* Read a MH/maildir style mailbox. * * args: @@ -1208,7 +1220,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 ae90114e6ef3 -r c604cde63935 mx.c --- a/mx.c Thu May 05 14:40:15 2016 -0400 +++ b/mx.c Thu May 05 15:09:18 2016 -0400 @@ -722,7 +722,7 @@ switch (ctx->magic) { case M_MH: - rc = mh_read_dir (ctx, NULL); + rc = mh_open_mailbox (ctx); break; case M_MAILDIR: diff -r ae90114e6ef3 -r c604cde63935 mx.h --- a/mx.h Thu May 05 14:40:15 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 *);