From 6f31b356b2b21882b439324d233aceec413f4737 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 31 Mar 2010 03:14:32 -0400
Subject: [PATCH] - fix save/delete draft message with enabled threading (#1486596) - performance improvement using UID SEARCH intead of SEARCH + FETCH - re-fix r3445

---
 program/include/rcube_imap_generic.php |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index ed2788a..41c053d 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -366,7 +366,7 @@
         }
     
         // generate hash
-        $hash  = md5($this->xor($pass,$opad) . pack("H*", md5($this->xor($pass, $ipad) . base64_decode($encChallenge))));
+        $hash  = md5($this->_xor($pass,$opad) . pack("H*", md5($this->_xor($pass, $ipad) . base64_decode($encChallenge))));
     
         // generate reply
         $reply = base64_encode($user . ' ' . $hash);
@@ -1553,18 +1553,19 @@
 	    return false;	
     }
 
-    function search($folder, $criteria)
+    function search($folder, $criteria, $return_uid=false)
     {
 	    if (!$this->select($folder)) {
     		return false;
 	    }
 
     	$data = '';
-	    $query = "srch1 SEARCH " . chop($criteria);
+	    $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria);
 
 	    if (!$this->putLineC($query)) {
 		    return false;
 	    }
+
     	do {
 	    	$line = trim($this->readLine());
 		    if ($this->startsWith($line, '* SEARCH')) {
@@ -2150,7 +2151,7 @@
 	    return $result;
     }
 
-    private function xor($string, $string2)
+    private function _xor($string, $string2)
     {
 	    $result = '';
 	    $size = strlen($string);

--
Gitblit v1.9.1