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/imap.inc |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 7f4c93a..6ca5220 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1220,8 +1220,10 @@
 					$i++;
 					$lines[$i] = trim(chop($line));
 				}
-			}while($line[0]!=")");
+			}while($line[0]!=")" && strncmp($line, $key, strlen($key)));  // patch from "Maksim Rubis" <siburny@hotmail.com>
 			
+            if(strncmp($line, $key, strlen($key)))
+            { 
 			//process header, fill iilBasicHeader obj.
 			//	initialize
 			if (is_array($headers)){
@@ -1256,6 +1258,10 @@
 			if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2);
 			else $messageID = "mid:".$id;
 			$result[$id]->messageID = $messageID;
+			}
+            else {
+            $a=explode(" ", $line);
+            } 
 			
 		}
 	}while(strcmp($a[0], $key)!=0);
@@ -1371,6 +1377,7 @@
 	if ($field=="date"||$field=='internaldate') $field="timestamp";
 	if (empty($flag)) $flag="ASC";
 	$flag=strtoupper($flag);
+	$stripArr = ($field=='subject') ? array('Re: ','Fwd: ','Fw: ',"\"") : array("\"");
 	
 	$c=count($a);
 	if ($c>0){
@@ -1386,7 +1393,7 @@
 		reset($a);
 		while (list($key, $val)=each($a)){
 			$data=$a[$key]->$field;
-			if (is_string($data)) $data=strtoupper(str_replace("\"", "", $data));
+			if (is_string($data)) $data=strtoupper(str_replace($stripArr, "", $data));
 			$index[$key]=$data;
 		}
 		

--
Gitblit v1.9.1