Mark Crispin wrote:

Please send a copy of the patch to me and I will look at it. If nothing else, I can offer suggestions for your patch so that it is likely to remain usable in future releases.

On the off chance that my patch may be useful to others, I have polished it up a bit.

And I would indeed appreciate your comments, Mark.

A tar ball is available at:

The README file is available at:


It should be much easier to use now.

It is free of my configuration details.

It does not change the exiting UNIX driver. It adds a new "UNIXSUB" driver - as the default driver. So existing folders will still be accessible (unless there is another folder in the same directory named ".mail"!). Only new ones have the new structure.

It is no longer necessary to hide "dot files", and folder names beginning with a dot are allowed.

It is actually two patches.

The first patch is a minimal change to the IMAP base code. It is in "imap.diff", and these are its contents:

--- src/osdep/unix/dummy.c~     2003-03-05 17:37:40.000000000 -0700
+++ src/osdep/unix/dummy.c      2003-08-23 19:42:27.000000000 -0600
@@ -233,8 +233,11 @@
   struct stat sbuf;
   int ismx;
   char tmp[MAILTMPLEN];
+  char is_mailbox = 0;
                                /* punt if bogus name */
   if (!mailboxdir (tmp,dir,NIL)) return;
+                               /* is this a mail box? */
+  is_mailbox = (mail_valid(NIL, tmp, NIL) != NIL);
   if (dp = opendir (tmp)) {    /* do nothing if can't open directory */
                                /* list it if not at top-level */
     if (!level && dir && pmatch_full (dir,pat,'/'))
@@ -274,6 +277,7 @@
              dummy_list_work (stream,tmp,pat,contents,level+1);
          case S_IFREG:         /* ordinary name */
+           if (!is_mailbox)    /* ignore regular file within mailbox */
                                /* ignore all-digit names from mx */
            /* Must use ctime for systems that don't update mtime properly */
            if (!(ismx && mx_select (d)) && pmatch_full (tmp,pat,'/') &&

The "imap.diff" patch introduces into UW-IMAP the notion that a directory can be a mail box. And for a directory that is a mail box,it will ignore any regular files (i.e. not subdirectories) within that directory when scanning the file system. The result is that these will not be visible to an IMAP client. It is up to the mailbox driver for the directory to use these files.

It is my hope that "imap.diff", or some equivalent change will be accepted into UW-IMAP, whether or not the driver itself is.

The rest of the package is the actual driver, which is still really just a hack of the UNIX driver. I would never expect this to get into the UW-IMAP code. But I think it makes a case for the technique used to allow folders within folders. One short coming I can think of is that there should be something in the ".mail" files that is unique to this driver, which would then be used within the "VALID" macro to ensure that a ".mail" file for this driver is never mistaken for a UNIX driver folder.


Reply via email to