Sequence->ID lookup fixes
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 27 Mar 2009 04:02:56 +0000 (22:02 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 27 Mar 2009 04:02:56 +0000 (22:02 -0600)
framework/Imap_Client/lib/Horde/Imap/Client/Base.php
framework/Imap_Client/lib/Horde/Imap/Client/Socket.php

index c0faf83..9a6028b 100644 (file)
@@ -2436,8 +2436,12 @@ abstract class Horde_Imap_Client_Base
      */
     protected function _getSeqUIDLookup($ids, $seq)
     {
-        $search = new Horde_Imap_Client_Search_Query();
-        $search->sequence($ids, $seq);
+        if (is_null($ids)) {
+            $search = null;
+        } else {
+            $search = new Horde_Imap_Client_Search_Query();
+            $search->sequence($ids, $seq);
+        }
         $res = $this->search($this->_selected, $search, array('sort' => array(Horde_Imap_Client::SORT_ARRIVAL)));
         $ret = array('uids' => $res['sort']);
         if ($seq) {
index 47e34ec..ee1a677 100644 (file)
@@ -1347,7 +1347,8 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
          * we will get VANISHED responses, so we need to do this. */
         if ($use_cache && is_null($s_res)) {
             /* Keys in $s_res['sort'] start at 0, not 1. */
-            $s_res = $this->search($mailbox, null, array('sort' => array(Horde_Imap_Client::SORT_ARRIVAL)));
+            $s_res = $this->_getSeqUIDLookup(null, false);
+            $s_res['sort'] = $s_res['uids'];
         }
 
         $tmp = &$this->_temp;