MFB: Fix procmail vacation rule (micha@kovoks.nl, Bug #7052).
authorJan Schneider <jan@horde.org>
Wed, 16 Sep 2009 12:51:24 +0000 (14:51 +0200)
committerJan Schneider <jan@horde.org>
Wed, 16 Sep 2009 12:54:12 +0000 (14:54 +0200)
ingo/docs/CHANGES
ingo/lib/Script/Procmail.php

index c721eeb..543f396 100644 (file)
@@ -10,6 +10,7 @@ v2.0-git
 v1.2.3-cvs
 ----------
 
+[jan] Fix procmail vacation rule (micha@kovoks.nl, Bug #7052).
 [jan] Prevent deadlock with vacation rule in maildrop driver (Bug #8577).
 
 
index f022843..c2b26f3 100644 (file)
@@ -467,63 +467,64 @@ class Procmail_Recipe {
             $this->_action[] = '{';
             foreach ($params['action-value']['addresses'] as $address) {
                 if (!empty($address)) {
-                    $this->_action[] = '  FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && '
+                    $this->_action[] = '  :0';
+                    $this->_action[] = '  * ^TO_' . $address;
+                    $this->_action[] = '  {';
+                    $this->_action[] = '    FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && '
                         . $this->_params['ls'] . ' -lcn --time-style=+%s ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' | '
                         . 'awk \'{ print $6 + (' . $days * 86400 . ') }\'`';
-                    $this->_action[] = '  DATE=`' . $this->_params['date'] . ' +%s`';
-                    $this->_action[] = '  DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && '
+                    $this->_action[] = '    DATE=`' . $this->_params['date'] . ' +%s`';
+                    $this->_action[] = '    DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && '
                         . 'test $FILEDATE -le $DATE && '
                         . 'rm ${VACATION_DIR:-.}/\'.vacation.' . $address . '\'`';
                     if ($timed) {
-                        $this->_action[] = '  START=' . $params['action-value']['start'];
-                        $this->_action[] = '  END=' . $params['action-value']['end'];
+                        $this->_action[] = '    START=' . $params['action-value']['start'];
+                        $this->_action[] = '    END=' . $params['action-value']['end'];
                     }
                     $this->_action[] = '';
-                    $this->_action[] = '  :0 h';
-                    $this->_action[] = '  SUBJECT=| formail -xSubject:';
+                    $this->_action[] = '    :0 h';
+                    $this->_action[] = '    SUBJECT=| formail -xSubject:';
                     $this->_action[] = '';
-                    $this->_action[] = '  :0 Whc: ${VACATION_DIR:-.}/vacation.lock';
+                    $this->_action[] = '    :0 Whc: ${VACATION_DIR:-.}/vacation.lock';
                     if ($timed) {
-                        $this->_action[] = '  * ? test $DATE -gt $START && test $END -gt $DATE';
-                        $this->_action[] = '  {';
-                        $this->_action[] = '  :0 Whc';
+                        $this->_action[] = '    * ? test $DATE -gt $START && test $END -gt $DATE';
+                       $this->_action[] = '    {';
+                        $this->_action[] = '      :0 Wh';
                     }
-                    $this->_action[] = '  * ^TO_' . $address;
-                    $this->_action[] = '  * !^X-Loop: ' . $address;
-                    $this->_action[] = '  * !^X-Spam-Flag: YES';
+                    $this->_action[] = '      * ^TO_' . $address;
+                    $this->_action[] = '      * !^X-Loop: ' . $address;
+                    $this->_action[] = '      * !^X-Spam-Flag: YES';
                     if (count($params['action-value']['excludes']) > 0) {
                         foreach ($params['action-value']['excludes'] as $exclude) {
                             if (!empty($exclude)) {
-                                $this->_action[] = '  * !^From.*' . $exclude;
+                                $this->_action[] = '      * !^From.*' . $exclude;
                             }
                         }
                     }
                     if ($params['action-value']['ignorelist']) {
-                        $this->_action[] = '  * !^FROM_DAEMON';
+                        $this->_action[] = '      * !^FROM_DAEMON';
                     }
-                    $this->_action[] = '  | formail -rD 8192 ${VACATION_DIR:-.}/.vacation.' . $address;
-                    $this->_action[] = '  :0 ehc';
-                    $this->_action[] = '  | (formail -rI"Precedence: junk" \\';
-                    $this->_action[] = '     -a"From: <' . $address . '>" \\';
-                    $this->_action[] = '     -A"X-Loop: ' . $address . '" \\';
+                    $this->_action[] = '      | formail -rD 8192 ${VACATION_DIR:-.}/.vacation.' . $address;
+                    $this->_action[] = '      :0 eh';
+                    $this->_action[] = '      | (formail -rI"Precedence: junk" \\';
+                    $this->_action[] = '       -a"From: <' . $address . '>" \\';
+                    $this->_action[] = '       -A"X-Loop: ' . $address . '" \\';
                     if (Horde_Mime::is8bit($params['action-value']['reason'])) {
-                        $this->_action[] = '     -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" \\';
-                        $this->_action[] = '     -i"Content-Transfer-Encoding: quoted-printable" \\';
-                        $this->_action[] = '     -i"Content-Type: text/plain; charset=' . Horde_Nls::getCharset() . '" ; \\';
+                        $this->_action[] = '       -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" \\';
+                        $this->_action[] = '       -i"Content-Transfer-Encoding: quoted-printable" \\';
+                        $this->_action[] = '       -i"Content-Type: text/plain; charset=' . Horde_Nls::getCharset() . '" ; \\';
                         $reason = Horde_Mime::quotedPrintableEncode($params['action-value']['reason'], "\n");
                     } else {
-                        $this->_action[] = '     -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" ; \\';
+                        $this->_action[] = '       -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" ; \\';
                         $reason = $params['action-value']['reason'];
                     }
                     $reason = addcslashes($reason, "\\\n\r\t\"`");
-                    $this->_action[] = '     ' . $this->_params['echo'] . ' -e "' . $reason . '" \\';
-                    $this->_action[] = '    ) | $SENDMAIL -f' . $address . ' -oi -t';
-                    $this->_action[] = '';
-                    $this->_action[] = '    :0';
-                    $this->_action[] = '    /dev/null';
+                    $this->_action[] = '       ' . $this->_params['echo'] . ' -e "' . $reason . '" \\';
+                    $this->_action[] = '      ) | $SENDMAIL -f' . $address . ' -oi -t';
                     if ($timed) {
-                        $this->_action[] = '  }';
+                        $this->_action[] = '    }';
                     }
+                    $this->_action[] = '  }';
                 }
             }
             $this->_action[] = '}';