# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462475374 14400
# Thu May 05 15:09:34 2016 -0400
# Node ID 97603fb152bcbf331ffe73db9cf64733d558701b
# Parent dc2a95980534595f3b7bbbc77006962ed11b8ff6
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 dc2a95980534 -r 97603fb152bc mh.c
--- a/mh.c Thu May 05 15:09:18 2016 -0400
+++ b/mh.c Thu May 05 15:09:34 2016 -0400
@@ -1223,7 +1223,7 @@
}
/* read a maildir style mailbox */
-int maildir_read_dir (CONTEXT * ctx)
+static int maildir_read_dir (CONTEXT * ctx)
{
/* maildir looks sort of like MH, except that there are two subdirectories
* of the main folder path from which to read messages
@@ -1234,6 +1234,15 @@
return 0;
}
+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);
@@ -2357,6 +2366,10 @@
return 0;
}
+struct mx_ops mx_maildir_ops = {
+ .close = mh_close_mailbox,
+};
+
struct mx_ops mx_mh_ops = {
.close = mh_close_mailbox,
};
diff -r dc2a95980534 -r 97603fb152bc 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 dc2a95980534 -r 97603fb152bc mx.h
--- a/mx.h Thu May 05 15:09:18 2016 -0400
+++ b/mx.h Thu May 05 15:09:34 2016 -0400
@@ -58,7 +58,7 @@
int mh_check_mailbox (CONTEXT *, int *);
int mh_check_empty (const char *);
-int maildir_read_dir (CONTEXT *);
+int maildir_open_mailbox (CONTEXT *);
int maildir_check_mailbox (CONTEXT *, int *);
int maildir_check_empty (const char *);
@@ -81,6 +81,7 @@
int mx_lock_file (const char *, int, int, int, int);
int mx_unlock_file (const char *path, int fd, int dot);
+extern struct mx_ops mx_maildir_ops;
extern struct mx_ops mx_mbox_ops;
extern struct mx_ops mx_mh_ops;