[dev][patch] Re: ingo procmail patch

Martin Luethi horde at humbapa.ch
Tue Mar 9 00:15:49 PST 2004


attached is a small patch who adds a new "scriptparams-option" in
ingo/config/backends.php:

// Whether the spaces (' ') in folder names should be escaped
// ('\ ') or not. Default is to not escape spaces.
'escape_spaces' => false,

g. martin luethi


Mon,  8 Mar 2004 09:30:54 -0600 Ben Chavet <ben at chavet.net>:
> I'm running procmail 3.22 with postfix using mbox.  before my patch, I had a
> rule to go to mail/Virus Alerts.  Whenever this rule matched, though, 
> it would
> create a mail/Virus folder and put the message in there.  Using mail/Virus\
> Alerts took care of this.
>
> I didn't test the patch on a maildir setup because I don't have one readily
> available, I just assumed that it would behave the same...apparently I was
> wrong :).  The attached patch reverts the maildir portion of my
> original patch.
>
> --Ben
-------------- next part --------------
Index: lib/Script/procmail.php
===================================================================
RCS file: /repository/ingo/lib/Script/procmail.php,v
retrieving revision 1.42
diff -u -r1.42 procmail.php
--- lib/Script/procmail.php	3 Mar 2004 20:28:54 -0000	1.42
+++ lib/Script/procmail.php	9 Mar 2004 08:03:07 -0000
@@ -543,6 +543,10 @@
      */
     function procmailPath($folder)
     {
+        if (!empty($folder) && 
+            !empty($this->_params['escape_spaces'])) {
+            $folder = str_replace(' ', '\ ', $folder);
+        }
         /* NOTE: '$DEFAULT' here is a literal, not a PHP variable. */
         if (isset($this->_params) &&
             ($this->_params['path_style'] == 'maildir')) {
@@ -552,12 +556,12 @@
             if (substr($folder, 0, 6) == 'INBOX.') {
                 $folder = substr($folder, 6);
             }
-            return '"$DEFAULT/.' . str_replace(' ', '\ ', $folder) . '/"';
+            return '"$DEFAULT/.' . $folder . '/"';
         } else {
             if (empty($folder) || ($folder == 'INBOX')) {
                 return '$DEFAULT';
             }
-            return str_replace(' ', '\ ', $folder);
+            return $folder;
         }
     }
 
-------------- next part --------------
Index: config/backends.php.dist
===================================================================
RCS file: /repository/ingo/config/backends.php.dist,v
retrieving revision 1.14
diff -u -r1.14 backends.php.dist
--- config/backends.php.dist	19 Jan 2004 19:50:50 -0000	1.14
+++ config/backends.php.dist	9 Mar 2004 08:09:28 -0000
@@ -64,6 +64,9 @@
     'scriptparams' => array(
         // What path style does the IMAP server use ['mbox'|'maildir']?
         'path_style' => 'mbox',
+        // Whether the spaces (' ') in folder names should be escaped 
+        // ('\ ') or not. Default is to not escape spaces.
+        'escape_spaces' => false,
         // An array of variables to append to every generated script.
         // Use if you need to set up specific environment variables.
         'variables' => array(


More information about the dev mailing list