Changeset 3446 in subversion


Ignore:
Timestamp:
Mar 31, 2010 3:14:32 AM (3 years ago)
Author:
alec
Message:
  • fix save/delete draft message with enabled threading (#1486596)
  • performance improvement using UID SEARCH intead of SEARCH + FETCH
  • re-fix r3445
Location:
trunk/roundcubemail/program
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap.php

    r3443 r3446  
    14151415    } 
    14161416     
     1417 
     1418    /** 
     1419     * Direct (real and simple) SEARCH request to IMAP server, 
     1420     * without result sorting and caching 
     1421     * 
     1422     * @param  string  Mailbox name to search in 
     1423     * @param  string  Search string 
     1424     * @param  boolean True if UIDs should be returned 
     1425     * @return array   Search results as list of message IDs or UIDs 
     1426     * @access public 
     1427     */ 
     1428    function search_once($mbox_name='', $str=NULL, $ret_uid=false) 
     1429    { 
     1430        if (!$str) 
     1431            return false; 
     1432     
     1433        $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
     1434 
     1435        return $this->conn->search($mailbox, $str, $ret_uid); 
     1436    } 
     1437 
    14171438   
    14181439    /** 
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r3445 r3446  
    367367     
    368368        // generate hash 
    369         $hash  = md5($this->xor($pass,$opad) . pack("H*", md5($this->xor($pass, $ipad) . base64_decode($encChallenge)))); 
     369        $hash  = md5($this->_xor($pass,$opad) . pack("H*", md5($this->_xor($pass, $ipad) . base64_decode($encChallenge)))); 
    370370     
    371371        // generate reply 
     
    15541554    } 
    15551555 
    1556     function search($folder, $criteria) 
     1556    function search($folder, $criteria, $return_uid=false) 
    15571557    { 
    15581558            if (!$this->select($folder)) { 
     
    15611561 
    15621562        $data = ''; 
    1563             $query = "srch1 SEARCH " . chop($criteria); 
     1563            $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria); 
    15641564 
    15651565            if (!$this->putLineC($query)) { 
    15661566                    return false; 
    15671567            } 
     1568 
    15681569        do { 
    15691570                $line = trim($this->readLine()); 
     
    21512152    } 
    21522153 
    2153     private function xor($string, $string2) 
     2154    private function _xor($string, $string2) 
    21542155    { 
    21552156            $result = ''; 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r3435 r3446  
    618618    { 
    619619    // delete previous saved draft 
    620     $a_deleteid = $IMAP->search($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$olddraftmessageid); 
    621  
    622     $deleted = $IMAP->delete_message($IMAP->get_uid($a_deleteid[0], $CONFIG['drafts_mbox']), $CONFIG['drafts_mbox']); 
     620    $a_deleteid = $IMAP->search_once($CONFIG['drafts_mbox'], 
     621        'HEADER Message-ID '.$olddraftmessageid, true); 
     622    $deleted = $IMAP->delete_message($a_deleteid, $CONFIG['drafts_mbox']); 
    623623 
    624624    // raise error if deletion of old draft failed 
     
    640640   
    641641  // remember new draft-uid 
    642   $draftids = $IMAP->search($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid); 
    643   $_SESSION['compose']['param']['_draft_uid'] = $IMAP->get_uid($draftids[0], $CONFIG['drafts_mbox']); 
     642  $draftuids = $IMAP->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid, true); 
     643  $_SESSION['compose']['param']['_draft_uid'] = $draftuids[0]; 
    644644 
    645645  // display success 
Note: See TracChangeset for help on using the changeset viewer.