--- mb2md-3.20.pl.orig Sun Aug 22 14:35:59 2004
+++ mb2md-3.20.pl Sun Aug 22 14:38:32 2004
# for i in *; do echo $i;su - $i -c "/bin/mb2md -s mail -l .mailboxlist -R -d Maildir";done
+# -i Output Maildir directory structure with IMAPdir style
+# directory names for use with BincIMAP.
-getopts('d:f:chms:r:l:R', \%opts) || usage();
+getopts('d:f:chms:r:l:Ri', \%opts) || usage();
usage() if ( defined($opts{h})
|| (!defined($opts{m}) && !defined($opts{s})) );
my $use_cl = undef; # defines whether we use the Content-Length: header if present
+my $imapdir = undef; # defines whether we output in IMAPdir format
# if option "-c" is given, we use the Content-Length: header if present
# dangerous! may be unreliable, as the whole CL stuff is a bad idea
+# if option "-i" is given, we output Maildir hierarchy in IMAPdir naming
+# format (e.g. Maildir/INBOX, Maildir/Mailbox1, etc.). Useful for BincIMAP
+if (defined($opts{i})) {
# first, if the user has gone the -m option
# we simply convert their mailfile
# Since we'll be making sub directories of the main
# Maildir, we need to make sure that the main maildir
+-d $dest or mkdir $dest,0700 or die("Fatal: Directory $dest doesn't exist and can't be created.\n");
# Now we do different things depending on whether we convert one mbox
# file or a directory of mbox files
+ # if IMAPdir output mode, append INBOX for inbox mbox
+ $dest .= "/INBOX" if defined($opts{m}) && $imapdir;
print "Converting $mbfile to maildir: $dest\n";
# this is easy, we just run the convert function
&convert($mbfile, $dest);