Re: Directory that is a mailbox

2003-08-24 Thread Creighton MacDonnell
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:

  http://gnudip2.sourceforge.net/imap/

The README file is available at:

  http://gnudip2.sourceforge.net/imap/patch/README

===

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.0 -0700
+++ src/osdep/unix/dummy.c  2003-08-23 19:42:27.0 -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);
break;
  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.

Thanks.



Re: Directory that is a mailbox

2003-08-22 Thread Jean-Luc Wasmer
> > I never expected to get a positive answer for my request...
> > I received a patch... incredible!
>
> Let me emphasize again that I am not promising to support this or to
> ensure it works with new releases.

You were perfectly clear... I was just surprised to realize I was not the
only one wanting this feature.

Thanks again for the patch...

JL



Re: Directory that is a mailbox

2003-08-22 Thread Mark Crispin
On Fri, 22 Aug 2003, Creighton MacDonnell wrote:
> I don't even know if the UW-IMAP devleopment team is interested in input
> of this sort from the user community. I only joined this mailing list
> recently myself.

We intend to support some kind of mailbox-directory function in the
future as an addition (not in lieu) to existing functionality.  The exact
nature of this is still under consideration.

We encourage people such as you to develop and distribute patches, even if
we do not choose to adopt them in the official distribution.  We receive
many suggested patches, and can adopt only a small number of them; but all
suggested patches are carefully considered.

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.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Directory that is a mailbox

2003-08-22 Thread Creighton MacDonnell
Jean-Luc Wasmer wrote:
I never expected to get a positive answer for my request...
I received a patch... incredible!
Let me emphasize again that I am not promising to support this or to 
ensure it works with new releases.

I'm new to this list... did you submit your patch to the maintainer of
UW-IMAP in the past?
It could be part of the default release but only activated by some
configuration option.
No. I did not.

I don't even know if the UW-IMAP devleopment team is interested in input 
of this sort from the user community. I only joined this mailing list 
recently myself.



Re: Directory that is a mailbox

2003-08-22 Thread Jean-Luc Wasmer
> I have a patch that I use on my version of IMAP that does this. I have
> attached it.

I never expected to get a positive answer for my request...
I received a patch... incredible!


> I have also responded because I ma tired of maintining this patch, and
> worrying that it will be too much work to retest it with each release. I
> want to encourage discussion on this list about some sort of extension
> to IMAP to provide this.

I'm new to this list... did you submit your patch to the maintainer of
UW-IMAP in the past?
It could be part of the default release but only activated by some
configuration option.


> The patch hacks the "unix" mailbox driver. Instead of "_" it uses
> ".mail" as a "special" file name.

I agree, ".mail" is more appropriate than "_".
I suggested "_" since it's what my directory mailbox file is called right
now (in order to be the first in the mailbox list).


> The patch used to do the same for the "mbx" mailbox driver

I use the unix driver.


JL



Re: Directory that is a mailbox

2003-08-22 Thread Creighton MacDonnell
I have a patch that I use on my version of IMAP that does this. I have 
attached it.

I do not vouch for its correctness (particularly regarding file locking) 
or usefulness. It also reflects all of my confgiuration changes, some of 
which have nothing to do with "Directory that is a mailbox".

I have responded in this way because I too like to have directories that 
are also mailboxes.

I have also responded because I ma tired of maintining this patch, and 
worrying that it will be too much work to retest it with each release. I 
want to encourage discussion on this list about some sort of extension 
to IMAP to provide this.

The patch hacks the "unix" mailbox driver. Instead of "_" it uses 
".mail" as a "special" file name. The "hideDotFiles = T" configuration 
option is also important. It should of course be a seperate driver, and 
leave "unix" intact.

The patch used to do the same for the "mbx" mailbox driver (which is the 
preferred format I guess). But this stopped working a couple of releases 
ago, and I could not muster the desire to fix it. I might be willing to 
contribute some of my own time to adapt the technique to the standards 
and preferences of the UW-IMAP stewards, under their instruction, if the 
result found its way into the core code. But I may not have the depth of 
experience that they would want.

Jean-Luc Wasmer wrote:
Hi,

The FAQ section 1.10 says:

"Some mailbox formats, including the default which is the traditional UNIX
mailbox format, are stored as a single file containing all the messages.
UNIX does not permit a name in the filesystem to be both a file and a
directory; consequently you can not have a sub-mailbox within a mailbox that
is in one of these formats.
[...]
It is always permissible to create a directory that is not a mailbox, and
have sub-mailboxes under it."
I use this a lot. Unfortunatly, if I select a directory I get an error
because it's not a mailbox.
Would it be possible to interpret a file wih a special name (eg. "_") as the
mailbox of the parent directory?
So having the following file system tree:

Clients/
_
ClientA
ClientB
ClientC
would appear to the IMAP client like

Clients
ClientA
ClientB
ClientC
with Clients ClientA ClientB and ClientC four different mailboxes.

Mail in the "Clients" mailbox would be stored in the file Clients/_

Thanks,

JL

--
Creighton MacDonnell
http://macdonnell.ca/
--- ./src/imapd/Makefile~   2002-11-18 09:48:25.0 -0700
+++ ./src/imapd/Makefile2003-04-23 10:47:58.0 -0600
@@ -29,7 +29,7 @@
 # causes the "Manage Mail" menu item to open the given URL, e.g. to point to
 # an alternative IMAP client (e.g. Pine) or perhaps to a homebrew mail
 # account management page.
-#NSBD= -DNETSCAPE_BRAIN_DAMAGE=\"http://www.washington.edu/pine\";
+NSBD= -DNETSCAPE_BRAIN_DAMAGE=\"http://www.washington.edu/pine\";
 
 
 
--- ./src/osdep/unix/env_unix.c~2003-04-16 15:03:26.0 -0600
+++ ./src/osdep/unix/env_unix.c 2003-04-23 11:25:10.0 -0600
@@ -29,7 +29,7 @@
 static char *myMailboxDir = NIL;/* mailbox directory name */
 static char *myLocalHost = NIL;/* local host name */
 static char *myNewsrc = NIL;   /* newsrc file name */
-static char *mailsubdir = NIL; /* mail subdirectory name */
+static char *mailsubdir = "mail";   /* mail subdirectory name */
 static char *sysInbox = NIL;   /* system inbox name */
 static char *newsActive = NIL; /* news active file */
 static char *newsSpool = NIL;  /* news spool */
@@ -44,15 +44,15 @@
 static short anonymous = NIL;  /* is anonymous */
 static short blackBox = NIL;   /* is a black box */
 static short closedBox = NIL;  /* is a closed box */
-static short restrictBox = NIL;/* is a restricted box */
+static short restrictBox = T;  /* is a restricted box */
 static short has_no_life = NIL;/* is a cretin with no life */
/* flock() emulator is a no-op */
 static short disableFcntlLock = NIL;
-static short hideDotFiles = NIL;/* hide files whose names start with . */
+static short hideDotFiles = T; /* hide files whose names start with . */
/* advertise filesystem root */
 static short advertisetheworld = NIL;
/* disable automatic shared namespaces */
-static short noautomaticsharedns = NIL;
+static short noautomaticsharedns = T;
 static short no822tztext = NIL;/* disable RFC [2]822 timezone text */
 static short netfsstatbug = NIL;/* compensate for broken stat() on network
 * filesystems (AFS and old NFS).  Don't do
@@ -804,7 +804,7 @@
 {
   char tmp[MAILTMPLEN];
   if (!sysInbox) { /* initialize if first time */
-sprintf (tmp,"%s/%s",MAILSPOOL,myusername ());
+sprintf (tmp,"%s/mail/.inbox",myhomedir ());
 sysInbox = cpystr (tmp);   /* system inbox is from mail spool */
   }
   return sysInbox;
--- ./src/osdep/unix/env_unix.h~2002-02-22 21:03:45.00