| | |
| | | return $a_mboxes; |
| | | } |
| | | |
| | | $a_mboxes = $this->_list_folders_subscribed($root, $name, $filter, $rights); |
| | | // Give plugins a chance to provide a list of folders |
| | | $data = rcube::get_instance()->plugins->exec_hook('storage_folders', |
| | | array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LSUB')); |
| | | |
| | | if (isset($data['folders'])) { |
| | | $a_mboxes = $data['folders']; |
| | | } |
| | | else { |
| | | $a_mboxes = $this->list_folders_subscribed_direct($root, $name); |
| | | } |
| | | |
| | | if (!is_array($a_mboxes)) { |
| | | return array(); |
| | |
| | | |
| | | |
| | | /** |
| | | * protected method for folders listing (LSUB) |
| | | * Method for direct folders listing (LSUB) |
| | | * |
| | | * @param string $root Optional root folder |
| | | * @param string $name Optional name pattern |
| | | * @param mixed $filter Optional filter |
| | | * @param string $rights Optional ACL requirements |
| | | * |
| | | * @return array List of subscribed folders |
| | | * @see rcube_imap::list_folders_subscribed() |
| | | */ |
| | | protected function _list_folders_subscribed($root='', $name='*', $filter=null, $rights=null) |
| | | public function list_folders_subscribed_direct($root='', $name='*') |
| | | { |
| | | $a_defaults = $a_out = array(); |
| | | |
| | | // Give plugins a chance to provide a list of folders |
| | | $data = rcube::get_instance()->plugins->exec_hook('storage_folders', |
| | | array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LSUB')); |
| | | |
| | | if (isset($data['folders'])) { |
| | | $a_folders = $data['folders']; |
| | | } |
| | | else if (!$this->check_connection()) { |
| | | if (!$this->check_connection()) { |
| | | return null; |
| | | } |
| | | else { |
| | | // Server supports LIST-EXTENDED, we can use selection options |
| | | |
| | | $config = rcube::get_instance()->config; |
| | | |
| | | // Server supports LIST-EXTENDED, we can use selection options |
| | | // #1486225: Some dovecot versions returns wrong result using LIST-EXTENDED |
| | | if (!$config->get('imap_force_lsub') && $this->get_capability('LIST-EXTENDED')) { |
| | | // This will also set folder options, LSUB doesn't do that |
| | |
| | | if (!$this->folder_exists($folder)) { |
| | | $this->conn->unsubscribe($folder); |
| | | unset($a_folders[$idx]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else { |
| | | // retrieve list of folders from IMAP server |
| | | $a_mboxes = $this->_list_folders($root, $name); |
| | | $a_mboxes = $this->list_folders_direct($root, $name); |
| | | } |
| | | |
| | | if (!is_array($a_mboxes)) { |
| | |
| | | |
| | | |
| | | /** |
| | | * protected method for folders listing (LIST) |
| | | * Method for direct folders listing (LIST) |
| | | * |
| | | * @param string $root Optional root folder |
| | | * @param string $name Optional name pattern |
| | |
| | | * @return array List of folders |
| | | * @see rcube_imap::list_folders() |
| | | */ |
| | | protected function _list_folders($root='', $name='*') |
| | | public function list_folders_direct($root='', $name='*') |
| | | { |
| | | if (!$this->check_connection()) { |
| | | return null; |