Tired of hunting down deleted maildirs and folders this patch for maildrop will automagically create/recreate missing directories.
For this to work one has to use maildrop for delivery (duh!) and specify the target (DEFAULT) with a trailing slash (.Maildir/) or a slash-dot (.../.foldername/.) as used in SQWebmail-filters.
I dont think there are any problems with this new functionality, and wont mind if it gets integrated into the distribution ;)
(dont destroy the tabs in the patch wile copy&paste)
# fix missing Maildir/Folder if specified with trailing slash[dot]
--- ../courier-0.43.0.orig/maildrop/maildir.C Sun Aug 10 01:14:59 2003
+++ maildrop/maildir.C Sat Aug 30 19:09:37 2003
@@ -47,33 +47,57 @@
//
////////////////////////////////////////////////////////////////////////////
+// PATCH: check/fix Maildir
+int _MaildirCheckFix(const char *dir, int autocreate)
+{
+struct stat stat_buf;
+
+ // check if directory exists
+ if (! stat(dir, &stat_buf) ) return( S_ISDIR(stat_buf.st_mode) );
+ if (! autocreate) return(0); // legacy fallback
+ fprintf(stderr, "DEBUG maildrop: mkdir %s\n", dir);
+ if (! mkdir(dir, 0700) ) return(1); // success
+ merr << "maildrop: mkdir " << dir << ": " << strerror(errno) << "\n";
This is not going to create a maildir.
Even if it did, it is not going to create a proper maildir folder (quota support would be broken).
pgp00000.pgp
Description: PGP signature
