Hi,

The patch below is a quick & dirty hack to make mutt handle Maildir++
(see http://www.inter7.com/courierimap/README.maildirquota.html).
folders and emulated sub-folders (with '.' as hierarchy separator).
It was generated against the latest mutt-1.5.x development (unstable)
CVS tree.

Here are my .muttrc settings to go with it:

set folder="maildir:/home/marc/Maildir:"
set 
mask="!(^(tmp|cur|new|courierimapuiddb|courierimapsubscribed|procmail.log|\.\.ev-summary|\.\.)$)"
set spoolfile=~/Maildir
set record=~/Maildir/.Sent

Again, this is a hack, not a proper solution. Use at your own risk.
I'm no mutt developer, just a user who was tired of waiting forever
for mutt to slowly load big folders through a courier-imap server running
over loopback. Now at least it can access them directly.

I've also applied Michael Elkins's Maildir header caching patch
(http://www.cs.hmc.edu/~me/mutt/patch-1.5.0.me.hcache.8) which
provides a good speed improvement too.

Improvements or a proper implementation are welcome. Please Cc: responses
to marc at mbsi.ca as I do not always monitor the lists.

Cheers
Marc

--- muttlib.c   2002/07/04 12:30:59     1.1
+++ muttlib.c   2002/07/04 12:52:28
@@ -477,6 +477,18 @@
     imap_expand_path (s, slen);
 #endif
 
+  if (mx_is_maildir (s) && Maildir) {
+         strcpy(tmp, strchr(s, ':') + 1);
+         if(t = strchr(tmp, ':')) {
+               *t = '/';
+               t++;
+               while(t = strchr(t, '/')) {
+                       *t = '.';
+               }
+         }
+         strfcpy(s, tmp, strlen(tmp) + 1);
+  }
+
   return (s);
 }
 
--- browser.c   2002/07/04 12:30:59     1.1
+++ browser.c   2002/07/04 12:30:59
@@ -608,6 +614,8 @@
       imap_browse (LastDir, &state);
     }
 #endif
+    if (!buffy && mx_is_maildir (LastDir))
+         mutt_expand_path (LastDir, sizeof (LastDir));
   }
 
   *f = 0;
--- mailbox.h   2002/07/04 12:30:59     1.1
+++ mailbox.h   2002/07/04 12:30:59
@@ -73,6 +73,7 @@
 #ifdef USE_POP
 int mx_is_pop (const char *);
 #endif
+int mx_is_maildir (const char *);
 
 int mx_access (const char*, int);
 int mx_check_empty (const char *);
--- mx.c        2002/07/04 12:30:59     1.1
+++ mx.c        2002/07/04 12:30:59
@@ -354,6 +354,14 @@
 }
 #endif
 
+int mx_is_maildir (const char *p)
+{
+  if (!p)
+    return 0;
+
+  return (url_check_scheme (p) == U_MAILDIR);
+}
+
 int mx_get_magic (const char *path)
 {
   struct stat st;
--- url.c       2002/07/04 12:30:59     1.1
+++ url.c       2002/07/04 12:30:59
@@ -36,6 +36,7 @@
   { "pop",     U_POP  },
   { "pops",    U_POPS  },
   { "mailto",  U_MAILTO },
+  { "maildir", U_MAILDIR },
   { NULL,      U_UNKNOWN}
 };
 
--- url.h       2002/07/04 12:30:59     1.1
+++ url.h       2002/07/04 12:30:59
@@ -9,6 +9,7 @@
   U_IMAP,
   U_IMAPS,
   U_MAILTO,
+  U_MAILDIR,
   U_UNKNOWN
 }
 url_scheme_t;

Reply via email to