On Thu, Jul 04, 2002 at 11:05:25AM -0700, Will Yardley wrote:
> Marc Boucher wrote:
> > On Thu, Jul 04, 2002 at 10:50:59AM -0700, Will Yardley wrote:
> > > Marc Boucher wrote:
> 
> > > > 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.
> > > 
> > > what exactly didn't work about using mutt with Maildir++ before?  i've
> > > never had a problem with it....
> > 
> > Try
> >     mutt -f +Folder
> > or
> >     mutt -f +Folder/Subfolder
> > 
> > to access
> > 
> > ~/Maildir/.Folder
> > or
> > ~/Maildir/.Folder.Subfolder
> > 
> > respectively.
> 
> yeah but you can do mutt -f .Folder
> or
> mutt -f .Folder.Subfolder...

yes, but it's not practical.

> i agree that a patch to enter folder names in the conventional way would
> be nice.... just wasn't sure what your patch did.
> 
> does it also make the folders show up "normally" in the folder index?

not yet, however the updated version below does reverse translation in
mutt_pretty_mailbox()..

Marc

--- muttlib.c   2002/07/04 12:30:59     1.1
+++ muttlib.c   2002/07/04 18:07:54
@@ -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);
 }
 
@@ -737,6 +749,24 @@
   }
   *q = 0;
 
+  if(Maildir && url_check_scheme(Maildir) == U_MAILDIR) {
+      char *mp, *mpe;
+
+      mp = strchr(Maildir, ':') + 1;
+      mpe = strchr(mp, ':');
+      if(mpe) {
+         len = mpe - mp;
+         if(!mutt_strncmp(s, mp, len) && s[len] == '/' && s[len+1] == '.') {
+             *s++ = '=';
+             memmove (s, s + len + 1, mutt_strlen (s + len + 1) + 1);
+             mp = s;
+             while(mp = strchr(mp, '.')) {
+                 *mp = '/';
+             }
+         }
+      }
+  }
+
   if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 &&
       s[len] == '/')
   {
--- mx.c        2002/07/04 10:57:51     1.1
+++ mx.c        2002/07/04 12:08:14
@@ -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 11:04:46     1.1
+++ url.c       2002/07/04 11:04:50
@@ -36,6 +36,7 @@
   { "pop",     U_POP  },
   { "pops",    U_POPS  },
   { "mailto",  U_MAILTO },
+  { "maildir", U_MAILDIR },
   { NULL,      U_UNKNOWN}
 };
 
--- url.h       2002/07/04 11:04:59     1.1
+++ url.h       2002/07/04 11:05:07
@@ -9,6 +9,7 @@
   U_IMAP,
   U_IMAPS,
   U_MAILTO,
+  U_MAILDIR,
   U_UNKNOWN
 }
 url_scheme_t;
--- browser.c   2002/07/04 11:42:43     1.1
+++ browser.c   2002/07/04 12:06:31
@@ -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:07:27     1.1
+++ mailbox.h   2002/07/04 12:07:37
@@ -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 *);

Reply via email to