Changeset 30b3022 in github


Ignore:
Timestamp:
Nov 4, 2010 10:03:26 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
ac2c953
Parents:
29b3973
Message:
  • Add possibility to force mailbox selection. There're situations where we're invoking STATUS (for all messages count) and SELECT later for other operations. If we call SELECT first, the STATUS will be not needed.
Location:
program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap.php

    rf75f65c r30b3022  
    114114    } 
    115115 
    116      
     116 
    117117    /** 
    118118     * Connect to an IMAP server 
     
    183183    } 
    184184 
    185      
     185 
    186186    /** 
    187187     * Close IMAP connection 
     
    196196    } 
    197197 
    198      
     198 
    199199    /** 
    200200     * Close IMAP connection and re-connect 
     
    234234        return ($this->conn) ? $this->conn->error : ''; 
    235235    } 
    236      
     236 
    237237 
    238238    /** 
     
    246246    } 
    247247 
    248      
     248 
    249249    /** 
    250250     * Set a root folder for the IMAP connection. 
     
    268268    } 
    269269 
    270      
     270 
    271271    /** 
    272272     * Set default message charset 
     
    282282    } 
    283283 
    284      
     284 
    285285    /** 
    286286     * This list of folders will be listed above all other folders 
     
    300300    } 
    301301 
    302      
     302 
    303303    /** 
    304304     * Set internal mailbox reference. 
     
    322322    } 
    323323 
    324      
     324 
     325    /** 
     326     * Forces selection of a mailbox 
     327     * 
     328     * @param  string $mailbox Mailbox/Folder name 
     329     * @access public 
     330     */ 
     331    function select_mailbox($mailbox) 
     332    { 
     333        $mailbox = $this->mod_mailbox($mailbox); 
     334 
     335        $selected = $this->conn->select($mailbox); 
     336 
     337        if ($selected && $this->mailbox != $mailbox) { 
     338            // clear messagecount cache for this mailbox 
     339            $this->_clear_messagecount($mailbox); 
     340            $this->mailbox = $mailbox; 
     341        } 
     342    } 
     343 
     344 
    325345    /** 
    326346     * Set internal list page 
     
    334354    } 
    335355 
    336      
     356 
    337357    /** 
    338358     * Set internal page size 
     
    346366    } 
    347367 
    348      
     368 
    349369    /** 
    350370     * Save a set of message ids for future message listing methods 
     
    373393    } 
    374394 
    375      
     395 
    376396    /** 
    377397     * Return the saved search set as hash array 
     
    389409    } 
    390410 
    391      
     411 
    392412    /** 
    393413     * Returns the currently used mailbox name 
     
    401421    } 
    402422 
    403      
     423 
    404424    /** 
    405425     * Returns the IMAP server's capability 
     
    414434    } 
    415435 
    416      
     436 
    417437    /** 
    418438     * Sets threading flag to the best supported THREAD algorithm 
     
    438458    } 
    439459 
    440      
     460 
    441461    /** 
    442462     * Checks the PERMANENTFLAGS capability of the current mailbox 
     
    454474    } 
    455475 
    456      
     476 
    457477    /** 
    458478     * Returns the delimiter that is used by the IMAP server for folder separation 
     
    472492    } 
    473493 
    474      
     494 
    475495    /** 
    476496     * Get message count for a specific mailbox 
     
    490510    } 
    491511 
    492      
     512 
    493513    /** 
    494514     * Private method for getting nr of messages 
  • program/steps/mail/pagenav.inc

    r29b3973 r30b3022  
    2121 
    2222$uid = get_input_value('_uid', RCUBE_INPUT_GET); 
    23 $cnt  = $IMAP->messagecount(NULL, 'ALL'); // Only messages, no threads here 
     23 
     24// Select mailbox first, for better performance 
     25$mbox_name = $IMAP->get_mailbox_name(); 
     26$IMAP->select_mailbox($mbox_name); 
     27 
     28// Get messages count (only messages, no threads here) 
     29$cnt  = $IMAP->messagecount(NULL, 'ALL'); 
    2430 
    2531if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC' 
Note: See TracChangeset for help on using the changeset viewer.