Changeset 5946 in subversion


Ignore:
Timestamp:
Mar 2, 2012 8:43:45 AM (15 months ago)
Author:
alec
Message:
  • Fix automatic unsubscribe of non-existent folders (with small perf fix)
Location:
trunk/roundcubemail/program/include
Files:
2 edited

Legend:

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

    r5917 r5946  
    25282528 
    25292529                // unsubscribe non-existent folders, remove from the list 
    2530                 if (is_array($a_folders) && $name == '*') { 
     2530                // we can do this only when LIST response is available 
     2531                if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { 
    25312532                    foreach ($a_folders as $idx => $folder) { 
    2532                         if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) 
     2533                        if (($opts = $this->conn->data['LIST'][$folder]) 
    25332534                            && in_array('\\NonExistent', $opts) 
    25342535                        ) { 
     
    25432544                $a_folders = $this->conn->listSubscribed($root, $name); 
    25442545 
    2545                 // unsubscribe non-existent folders, remove from the list 
    2546                 if (is_array($a_folders) && $name == '*') { 
     2546                // unsubscribe non-existent folders, remove them from the list, 
     2547                // we can do this only when LIST response is available 
     2548                if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { 
    25472549                    foreach ($a_folders as $idx => $folder) { 
    2548                         if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) 
    2549                             && in_array('\\Noselect', $opts) 
     2550                        if (!isset($this->conn->data['LIST'][$folder]) 
     2551                            || in_array('\\Noselect', $this->conn->data['LIST'][$folder]) 
    25502552                        ) { 
    25512553                            // Some servers returns \Noselect for existing folders 
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r5841 r5946  
    13531353                    } 
    13541354 
    1355                     // Add to options array 
    1356                     if (empty($this->data['LIST'][$mailbox])) 
    1357                         $this->data['LIST'][$mailbox] = $opts; 
    1358                     else if (!empty($opts)) 
    1359                         $this->data['LIST'][$mailbox] = array_unique(array_merge( 
    1360                             $this->data['LIST'][$mailbox], $opts)); 
     1355                    // store LSUB options only if not empty, this way 
     1356                    // we can detect a situation when LIST doesn't return specified folder 
     1357                    if (!empty($opts) || $cmd == 'LIST') { 
     1358                        // Add to options array 
     1359                        if (empty($this->data['LIST'][$mailbox])) 
     1360                            $this->data['LIST'][$mailbox] = $opts; 
     1361                        else if (!empty($opts)) 
     1362                            $this->data['LIST'][$mailbox] = array_unique(array_merge( 
     1363                                $this->data['LIST'][$mailbox], $opts)); 
     1364                    } 
    13611365                } 
    13621366                // * STATUS <mailbox> (<result>) 
Note: See TracChangeset for help on using the changeset viewer.