From e4867ea740cd0d03acb65fdc7a93f7764cc711b2 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 06 Nov 2007 13:24:25 -0500
Subject: [PATCH] Fix bugs #1484555, #1484646 and #1484639

---
 CHANGELOG                      |    7 +++++++
 program/include/session.inc    |    1 +
 program/steps/mail/search.inc  |    3 ++-
 program/steps/mail/compose.inc |    4 +---
 program/lib/imap.inc           |    4 ++--
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 59f2724..997c235 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,14 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2007/11/06 (thomasb)
+----------
+- Switch to/from when searcing in Sent folder (#1484555)
+- Correctly read the References header (#1484646)
+- Unset old cookie in before sending a new value (#1484639)
+
 2007/10/22 (tomekp)
+----------
 - update ru, eo localizations
 
 2007/10/17 (thomasb)
diff --git a/program/include/session.inc b/program/include/session.inc
index a4952d1..8a98fad 100644
--- a/program/include/session.inc
+++ b/program/include/session.inc
@@ -173,6 +173,7 @@
 
   session_id($random);
   $cookie = session_get_cookie_params();
+  setcookie(session_name(), "", time() -3600);
   setcookie(session_name(), $random, $cookie['lifetime'], $cookie['path']);
 
   return true;
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 05b1c00..264c3af 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1240,7 +1240,7 @@
 	/* FETCH date,from,subject headers */
 	$key="fh".($c++);
 	$prefix=$uidfetch?" UID":"";
-	$request=$key.$prefix." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCE)])\r\n";
+	$request=$key.$prefix." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCES)])\r\n";
 
 	if (!fputs($fp, $request)) return false;
 	do{
@@ -1295,7 +1295,7 @@
 			$result[$id]->encoding = str_replace("\n", " ", $headers["content-transfer-encoding"]);
 			$result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]);
 			$result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']);
-			$result[$id]->reference = $headers["reference"];
+			$result[$id]->references = $headers["references"];
 			
 			list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]);
 
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index d13f71a..5131010 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -86,9 +86,7 @@
     {
     $_SESSION['compose']['reply_uid'] = $msg_uid;
     $_SESSION['compose']['reply_msgid'] = $MESSAGE['headers']->messageID;
-    $_SESSION['compose']['references']  = $MESSAGE['headers']->reference;
-    $_SESSION['compose']['references'] .= !empty($MESSAGE['headers']->reference) ? ' ' : '';
-    $_SESSION['compose']['references'] .= $MESSAGE['headers']->messageID;
+    $_SESSION['compose']['references']  = trim($MESSAGE['headers']->references . " " . $MESSAGE['headers']->messageID);
 
     if (!empty($_GET['_all']))
       $MESSAGE['reply_all'] = 1;
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index a3f6dda..5ed6627 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -64,7 +64,8 @@
 // search in subject and sender by default
 else
 {
-  $subject = array("HEADER SUBJECT", "HEADER FROM");
+  $from = ($mbox == $CONFIG['sent_mbox'] || $mbox == $CONFIG['drafts_mbox']) ? "TO" : "FROM";
+  $subject = array("HEADER SUBJECT", "HEADER $from");
   $search = trim($str);
 }
 

--
Gitblit v1.9.1