]> granicus.if.org Git - mutt/commitdiff
Add a ':' flag to % expandos. This will make sure that any
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 4 Jul 2003 16:57:56 +0000 (16:57 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 4 Jul 2003 16:57:56 +0000 (16:57 +0000)
dots are converted into underscores.  (_ is already used for
lowercasing the result of an expando.)

init.h
muttlib.c

diff --git a/init.h b/init.h
index cf73f6bd2f8ce9b1739fb5d1b2e40d411fb623a5..a0b43f7860827e2c8fc34345b3804a8f71ae3342 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2469,6 +2469,10 @@ struct option_t MuttVars[] = {
   ** (_) sign.  For example, if you want to display the local hostname in
   ** lowercase, you would use:
   ** %_h
+  ** .pp
+  ** If you prefix the sequence character with a colon (:) character, mutt
+  ** will replace any dots in the expansion by underscores. This might be helpful 
+  ** with IMAP folders that don't like dots in folder names.
   */
   { "status_on_top",   DT_BOOL, R_BOTH, OPTSTATUSONTOP, 0 },
   /*
index 05d80c21aecfdaaa3434951f87afbc92f3ba3a30..7994c95d2c294e884d44bf4c8c19b811d4164e76 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -1023,11 +1023,16 @@ void mutt_FormatString (char *dest,             /* output buffer */
       else
       {
        short tolower =  0;
+       short nodots  = 0;
        
-       if (ch == '_')
+       while (ch == '_' || ch == ':') 
        {
+         if (ch == '_')
+           tolower = 1;
+         else if (ch == ':') 
+           nodots = 1;
+         
          ch = *src++;
-         tolower = 1;
        }
        
        /* use callback function to handle this case */
@@ -1035,6 +1040,13 @@ void mutt_FormatString (char *dest,              /* output buffer */
 
        if (tolower)
          mutt_strlower (buf);
+       if (nodots) 
+       {
+         char *p = buf;
+         for (; *p; p++)
+           if (*p == '.')
+               *p = '_';
+       }
        
        if ((len = mutt_strlen (buf)) + wlen > destlen)
          len = (destlen - wlen > 0) ? (destlen - wlen) : 0;