# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462466200 14400
#      Thu May 05 12:36:40 2016 -0400
# Node ID 7172955709aa1f8ffff738276c9a8599834a76d1
# Parent  4ea9f535827ced38dcfc62e6b9fbaceba063a4a4
maildir: populate probe callback

For now, we rely on mx_get_magic to not make the implementation too
cumbersome. The point is to get rid of this "magic" anyway. We need to
create a dedicated mx_ops structure for that as the probe function is
different of the one for mh.

diff -r 4ea9f535827c -r 7172955709aa mh.c
--- a/mh.c      Thu May 05 12:32:32 2016 -0400
+++ b/mh.c      Thu May 05 12:36:40 2016 -0400
@@ -1166,11 +1166,21 @@
   return mx_get_magic(path) == M_MH;
 }
 
+static int maildir_probe(const char *path)
+{
+  return mx_get_magic(path) == M_MAILDIR;
+}
+
 struct mx_ops mx_mh_ops = {
   .probe = mh_probe,
   .close = mh_close_mailbox,
 };
 
+struct mx_ops mx_maildir_ops = {
+  .probe = maildir_probe,
+  .close = mh_close_mailbox,
+};
+
 /* Read a MH/maildir style mailbox.
  *
  * args:

Reply via email to