Changeset 3870bec in github


Ignore:
Timestamp:
Oct 26, 2010 9:44:39 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:
acd9bdd
Parents:
10a6fc58
Message:
  • Add support for selection options from LIST-EXTENDED extension (RFC 5258)
  • Don't list subscribed but non-existent folders (#1486225)
  • Fix \Noselect handling performance (#1487082)
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    ra5a4bf4 r3870bec  
    5050- Fix parent folder with unread subfolder not bold when message is open (#1487078) 
    5151- Add basic IMAP LIST's \Noselect option support 
     52- Add support for selection options from LIST-EXTENDED extension (RFC 5258) 
     53- Don't list subscribed but non-existent folders (#1486225) 
    5254 
    5355RELEASE 0.4.2 
  • program/include/main.inc

    ra5a4bf4 r3870bec  
    13571357  $path .= $currentFolder; 
    13581358 
    1359   // Check \Noselect option 
    1360   if (!$virtual) { 
    1361     $opts = $RCMAIL->imap->mailbox_options($path); 
     1359  // Check \Noselect option (if options are in cache) 
     1360  if (!$virtual && ($opts = $RCMAIL->imap->mailbox_options($path))) { 
    13621361    $virtual = in_array('\\Noselect', $opts); 
    13631362  } 
  • program/include/rcube_imap.php

    rfa2173c r3870bec  
    28172817        } 
    28182818        else { 
    2819             // retrieve list of folders from IMAP server 
    2820             $a_folders = $this->conn->listSubscribed($this->mod_mailbox($root), $filter); 
     2819            // Server supports LIST-EXTENDED, we can use selection options 
     2820            if ($this->get_capability('LIST-EXTENDED')) { 
     2821                // This will also set mailbox options, LSUB doesn't do that 
     2822                $a_folders = $this->conn->listMailboxes($this->mod_mailbox($root), $filter, 
     2823                    NULL, array('SUBSCRIBED')); 
     2824 
     2825                // remove non-existent folders 
     2826                if (is_array($a_folders)) { 
     2827                    foreach ($a_folders as $idx => $folder) { 
     2828                        if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) 
     2829                            && in_array('\\NonExistent', $opts) 
     2830                        ) { 
     2831                            unset($a_folders[$idx]); 
     2832                        }  
     2833                    } 
     2834                } 
     2835            } 
     2836            // retrieve list of folders from IMAP server using LSUB 
     2837            else { 
     2838                $a_folders = $this->conn->listSubscribed($this->mod_mailbox($root), $filter); 
     2839            } 
    28212840        } 
    28222841 
     
    31223141 
    31233142    /** 
    3124      * Gets folder options from LIST/LSUB response, e.g. \Noselect, \Noinferiors 
     3143     * Gets folder options from LIST response, e.g. \Noselect, \Noinferiors 
    31253144     * 
    31263145     * @param string $mbox_name Folder name 
     3146     * @param bool   $force     Set to True if options should be refreshed 
     3147     *                          Options are available after LIST command only 
    31273148     * 
    31283149     * @return array Options list 
    31293150     */ 
    3130     function mailbox_options($mbox_name) 
     3151    function mailbox_options($mbox_name, $force=false) 
    31313152    { 
    31323153        $mbox = $this->mod_mailbox($mbox_name); 
     
    31373158 
    31383159        if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mbox])) { 
    3139             $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name); 
     3160            if ($force) { 
     3161                $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name); 
     3162            } 
     3163            else { 
     3164                return array(); 
     3165            } 
    31403166        } 
    31413167 
  • program/include/rcube_imap_generic.php

    r4757608 r3870bec  
    18271827     * @param string $mailbox     Mailbox name 
    18281828     * @param array  $status_opts (see self::_listMailboxes) 
     1829     * @param array  $select_opts (see self::_listMailboxes) 
    18291830     * 
    18301831     * @return array List of mailboxes or hash of options if $status_opts argument 
     
    18321833     * @access public 
    18331834     */ 
    1834     function listMailboxes($ref, $mailbox, $status_opts=array()) 
    1835     { 
    1836         return $this->_listMailboxes($ref, $mailbox, false, $status_opts); 
     1835    function listMailboxes($ref, $mailbox, $status_opts=array(), $select_opts=array()) 
     1836    { 
     1837        return $this->_listMailboxes($ref, $mailbox, false, $status_opts, $select_opts); 
    18371838    } 
    18381839 
     
    18441845     * @param array  $status_opts (see self::_listMailboxes) 
    18451846     * 
    1846      * @return array List of mailboxes or hash of options if $status_ops argument 
     1847     * @return array List of mailboxes or hash of options if $status_opts argument 
    18471848     *               is non-empty. 
    18481849     * @access public 
     
    18501851    function listSubscribed($ref, $mailbox, $status_opts=array()) 
    18511852    { 
    1852         return $this->_listMailboxes($ref, $mailbox, true, $status_opts); 
     1853        return $this->_listMailboxes($ref, $mailbox, true, $status_opts, NULL); 
    18531854    } 
    18541855 
     
    18611862     * @param array  $status_opts List of STATUS options (RFC5819: LIST-STATUS) 
    18621863     *                            Possible: MESSAGES, RECENT, UIDNEXT, UIDVALIDITY, UNSEEN 
     1864     * @param array  $select_opts List of selection options (RFC5258: LIST-EXTENDED) 
     1865     *                            Possible: SUBSCRIBED, RECURSIVEMATCH, REMOTE 
    18631866     * 
    18641867     * @return array List of mailboxes or hash of options if $status_ops argument 
     
    18661869     * @access private 
    18671870     */ 
    1868     private function _listMailboxes($ref, $mailbox, $subscribed=false, $status_opts=array()) 
     1871    private function _listMailboxes($ref, $mailbox, $subscribed=false, 
     1872        $status_opts=array(), $select_opts=array()) 
    18691873    { 
    18701874                if (empty($mailbox)) { 
     
    18761880            } 
    18771881 
    1878         $args = array($this->escape($ref), $this->escape($mailbox)); 
     1882        $args = array(); 
     1883 
     1884        if (!empty($select_opts) && $this->getCapability('LIST-EXTENDED')) { 
     1885            $select_opts = (array) $select_opts; 
     1886 
     1887            $args[] = '(' . implode(' ', $select_opts) . ')'; 
     1888        } 
     1889 
     1890        $args[] = $this->escape($ref); 
     1891        $args[] = $this->escape($mailbox); 
    18791892 
    18801893        if (!empty($status_opts) && $this->getCapability('LIST-STATUS')) { 
    1881             $status_opts = array($status_opts); 
     1894            $status_opts = (array) $status_opts; 
    18821895            $lstatus = true; 
    18831896 
     
    18951908                    list($opts, $delim, $folder) = $this->tokenizeResponse($response, 3); 
    18961909 
     1910                    // Add to result array 
    18971911                    if (!$lstatus) { 
    18981912                                    $folders[] = $folder; 
     
    19021916                    } 
    19031917 
    1904                     if ($cmd == 'LIST') { 
    1905                         $this->data['LIST'][$folder] = $opts; 
     1918                    // Add to options array 
     1919                    if (!empty($opts)) { 
     1920                        if (empty($this->data['LIST'][$folder])) 
     1921                            $this->data['LIST'][$folder] = $opts; 
     1922                        else 
     1923                            $this->data['LIST'][$folder] = array_unique(array_merge( 
     1924                                $this->data['LIST'][$folder], $opts)); 
    19061925                    } 
    19071926                } 
Note: See TracChangeset for help on using the changeset viewer.