Fix for folding inside msg-id's
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 10 May 2003 12:15:19 +0000 (12:15 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 10 May 2003 12:15:19 +0000 (12:15 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4855 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/deliver/Deliver.class.php

index 5b7a965..a053b02 100644 (file)
@@ -339,12 +339,33 @@ class Deliver {
        }
        $cnt = count($header);
        $hdr_s = '';
+
        for ($i = 0 ; $i < $cnt ; $i++) {
-           $hdr_s .= $this->foldLine($header[$i], 78, str_pad('',4));
+            $sKey = substr($header[$i],0,strpos($header[$i],':'));
+            switch ($sKey)
+            {
+            case 'Message-ID':
+            case 'In-Reply_To':
+                $hdr_s .= $header[$i];
+                break;
+            case 'References':
+                $sRefs = substr($header[$i],12);
+                $aRefs = explode(' ',$sRefs);
+                $sLine = 'References:';
+                foreach ($aRefs as $sReference) {
+                    if (strlen($sLine)+strlen($sReference) >76) {
+                        $hdr_s .= $sLine;
+                        $sLine = $rn . '    ' . $sReference;
+                    } else {
+                        $sLine .= ' '. $sReference;
+                    }
+                }
+                $hdr_s .= $sLine;
+                break;
+            default: $hdr_s .= $this->foldLine($header[$i], 78, str_pad('',4)); break;
+            }
        }
 
-//     $debug = "Debug: <123456789012345678901234567890123456789012345678901234567890123456789>\r\n";
-//     $this->foldLine($debug, 78, str_pad('',4));
        $header = $hdr_s;
        $header .= $rn; /* One blank line to separate header and body */
        $raw_length += strlen($header);