| | |
| | | { |
| | | $mode = strtoupper($mode); |
| | | |
| | | // count search set |
| | | if ($this->search_string && $mailbox == $this->mailbox && ($mode == 'ALL' || $mode == 'THREADS') && !$force) { |
| | | // count search set, assume search set is always up-to-date (don't check $force flag) |
| | | if ($this->search_string && $mailbox == $this->mailbox && ($mode == 'ALL' || $mode == 'THREADS')) { |
| | | if ($this->search_threads) |
| | | return $mode == 'ALL' ? count((array)$this->search_set['depth']) : count((array)$this->search_set['tree']); |
| | | else |
| | |
| | | NULL, array('SUBSCRIBED')); |
| | | |
| | | // unsubscribe non-existent folders, remove from the list |
| | | if (is_array($a_folders) && $name == '*') { |
| | | // we can do this only when LIST response is available |
| | | if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { |
| | | foreach ($a_folders as $idx => $folder) { |
| | | if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) |
| | | if (($opts = $this->conn->data['LIST'][$folder]) |
| | | && in_array('\\NonExistent', $opts) |
| | | ) { |
| | | $this->conn->unsubscribe($folder); |
| | |
| | | else { |
| | | $a_folders = $this->conn->listSubscribed($root, $name); |
| | | |
| | | // unsubscribe non-existent folders, remove from the list |
| | | if (is_array($a_folders) && $name == '*') { |
| | | // unsubscribe non-existent folders, remove them from the list, |
| | | // we can do this only when LIST response is available |
| | | if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { |
| | | foreach ($a_folders as $idx => $folder) { |
| | | if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) |
| | | && in_array('\\Noselect', $opts) |
| | | if (!isset($this->conn->data['LIST'][$folder]) |
| | | || in_array('\\Noselect', $this->conn->data['LIST'][$folder]) |
| | | ) { |
| | | // Some servers returns \Noselect for existing folders |
| | | if (!$this->mailbox_exists($folder)) { |
| | |
| | | $options['rights'] = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); |
| | | $options['special'] = in_array($mailbox, $this->default_folders); |
| | | |
| | | // Set 'noselect' and 'norename' flags |
| | | // Set 'noselect' flag |
| | | if (is_array($options['attributes'])) { |
| | | foreach ($options['attributes'] as $attrib) { |
| | | $attrib = strtolower($attrib); |
| | |
| | | $options['noselect'] = true; |
| | | } |
| | | |
| | | // Get folder rights (MYRIGHTS) |
| | | if ($acl && !$options['noselect']) { |
| | | // skip shared roots |
| | | if (!$options['is_root'] || $options['namespace'] == 'personal') { |
| | | $options['rights'] = (array)$this->my_rights($mailbox); |
| | | } |
| | | } |
| | | |
| | | // Set 'norename' flag |
| | | if (!empty($options['rights'])) { |
| | | $options['norename'] = !in_array('x', $options['rights']) && !in_array('d', $options['rights']); |
| | | |