[Dovecot] mbox to maildir conversion on a user-by-user basis!

Thomas Wouters thomas at xs4all.net
Fri Feb 3 14:51:40 EET 2006


On Thu, Feb 02, 2006 at 11:33:11AM -0800, Tony Kay wrote:

> 2. Use some procmail trickery to detect which format to deliver into (I am
> researching how to do the detection on a user-by-user basis)

procmail is smarter than dovecot in that (sorry, timo.) When delivering to a
mailbox 'mboxname', it will actually look at what 'mboxname' is. If it's a
file, it assumes mbox. If it's a directory, and 'mboxname' doesn't end in /,
it assumes MH. If 'mboxname' does end in /, it assumes maildir.

Of course, this doesn't completely fix your problem, since the default for a
directory is MH. That's relatively (considering procmail's *%*!@$* source)
easily fixed; we've used the attached patch for the last 8 or so years ;P

It would be nice if dovecot had similar intelligence: autodetect per mailbox
name, rather than per namespace. I have a half-finished 'mixed' namespace,
which ''subclasses'' from both mbox and maildir namespaces and chooses
per-mailbox on which functions to call. I hvaen't had the time to finish it,
though, and it depends fairly greatly on dovecot's mbox/maildir internals
(which is a bit problematic, considering dovecot's fluidity at the moment :)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
-------------- next part --------------
--- src/foldinfo.c.orig	Tue Sep 11 06:57:32 2001
+++ src/foldinfo.c	Tue Sep 24 17:18:34 2002
@@ -29,6 +29,7 @@
    extra trailing slashes */
 static int folderparse P((void))
 { char*chp;int type;
+  struct stat ft_STAT;
   type=ft_FILE;chp=strchr(buf,'\0');
   switch(chp-buf)
    { case 2:
@@ -47,6 +48,7 @@
      chp--;
 ret:
   *chp='\0';
+  if (!stat(buf,&ft_STAT)&&S_ISDIR(ft_STAT.st_mode)){return ft_MAILDIR;}
   return type;
 }
 


More information about the dovecot mailing list