From 583f1c8d80c42195d0ee41f30a885e13d777b79f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 08 Nov 2005 15:18:56 -0500
Subject: [PATCH] Added reply-to-all function (submitted by Julien Brette)

---
 program/lib/Mail/mimeDecode.php |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/program/lib/Mail/mimeDecode.php b/program/lib/Mail/mimeDecode.php
index 5bcf4fb..8514814 100644
--- a/program/lib/Mail/mimeDecode.php
+++ b/program/lib/Mail/mimeDecode.php
@@ -3,7 +3,7 @@
 // +-----------------------------------------------------------------------+
 // | Copyright (c) 2002-2003  Richard Heyes                                |
 // | Copyright (c) 2003-2005  The PHP Group                                |
-// | Licensed under the GNU GPL                                            |
+// | All rights reserved.                                                  |
 // |                                                                       |
 // | Redistribution and use in source and binary forms, with or without    |
 // | modification, are permitted provided that the following conditions    |
@@ -247,7 +247,7 @@
                         $return->ctype_primary   = $regs[1];
                         $return->ctype_secondary = $regs[2];
                     }
-
+                    
                     if (isset($content_type['other'])) {
                         while (list($p_name, $p_value) = each($content_type['other'])) {
                             $return->ctype_parameters[$p_name] = $p_value;
@@ -294,8 +294,9 @@
                         $this->_error = 'No boundary found for ' . $content_type['value'] . ' part';
                         return false;
                     }
-                    
+
                     $default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain';
+
                     $parts = $this->_boundarySplit($body, $content_type['other']['boundary']);
                     for ($i = 0; $i < count($parts); $i++) {
                         list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]);
@@ -498,14 +499,8 @@
         }
 
         $tmp = explode('--' . $boundary, $input);
-        $count = count($tmp);
 
-        // when boundaries are set correctly we should have at least 3 parts;
-        // if not, return the last one (tbr)
-        if ($count<3)
-          return array($tmp[$count-1]);
-        
-        for ($i = 1; $i < $count - 1; $i++) {
+        for ($i = 1; $i < count($tmp) - 1; $i++) {
             $parts[] = $tmp[$i];
         }
 

--
Gitblit v1.9.1