- Add basic IMAP LIST's \Noselect option support (mark unselectable folders as virtual, etc.)
| | |
| | | - Add support for IMAP proxy authentication (#1486690) |
| | | - Add support for AUTH=DIGEST-MD5 in IMAP (RFC 2831) |
| | | - Fix parent folder with unread subfolder not bold when message is open (#1487078) |
| | | - Add basic IMAP LIST's \Noselect option support |
| | | |
| | | RELEASE 0.4.2 |
| | | ------------- |
| | |
| | | */ |
| | | function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') |
| | | { |
| | | global $RCMAIL; |
| | | |
| | | $pos = strpos($folder, $delm); |
| | | |
| | | if ($pos !== false) { |
| | |
| | | |
| | | $path .= $currentFolder; |
| | | |
| | | // Check \Noselect option |
| | | if (!$virtual) { |
| | | $opts = $RCMAIL->imap->mailbox_options($path); |
| | | $virtual = in_array('\\Noselect', $opts); |
| | | } |
| | | |
| | | if (!isset($arrFolders[$currentFolder])) { |
| | | $arrFolders[$currentFolder] = array( |
| | | 'id' => $path, |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets folder options from LIST/LSUB response, e.g. \Noselect, \Noinferiors |
| | | * |
| | | * @param string $mbox_name Folder name |
| | | * |
| | | * @return array Options list |
| | | */ |
| | | function mailbox_options($mbox_name) |
| | | { |
| | | $mbox = $this->mod_mailbox($mbox_name); |
| | | |
| | | if ($mbox == 'INBOX') { |
| | | return array(); |
| | | } |
| | | |
| | | if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mbox])) { |
| | | $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name); |
| | | } |
| | | |
| | | $opts = $this->conn->data['LIST'][$mbox]; |
| | | |
| | | return is_array($opts) ? $opts : array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get message header names for rcube_imap_generic::fetchHeader(s) |
| | | * |
| | | * @return string Space-separated list of header names |
| | |
| | | return true; |
| | | } |
| | | |
| | | if (is_array($this->data['LIST']) && is_array($opts = $this->data['LIST'][$mailbox])) { |
| | | if (in_array('\\Noselect', $opts)) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | list($code, $response) = $this->execute('SELECT', array($this->escape($mailbox))); |
| | | |
| | | if ($code == self::ERROR_OK) { |
| | |
| | | if (empty($mailbox)) { |
| | | $mailbox = '*'; |
| | | } |
| | | /* |
| | | |
| | | if (empty($ref) && $this->prefs['rootdir']) { |
| | | $ref = $this->prefs['rootdir']; |
| | | } |
| | | */ |
| | | |
| | | $args = array($this->escape($ref), $this->escape($mailbox)); |
| | | |
| | | if (!empty($status_opts) && $this->getCapability('LIST-STATUS')) { |
| | |
| | | // * LIST (<options>) <delimiter> <mailbox> |
| | | if (!$lstatus || $cmd == 'LIST' || $cmd == 'LSUB') { |
| | | list($opts, $delim, $folder) = $this->tokenizeResponse($response, 3); |
| | | |
| | | if (!$lstatus) { |
| | | $folders[] = $folder; |
| | | } |
| | | else { |
| | | $folders[$folder] = array(); |
| | | } |
| | | |
| | | if ($cmd == 'LIST') { |
| | | $this->data['LIST'][$folder] = $opts; |
| | | } |
| | | } |
| | | // * STATUS <mailbox> (<result>) |
| | | else if ($cmd == 'STATUS') { |
| | |
| | | $a_subscribed = $IMAP->list_mailboxes(); |
| | | $a_threaded = $a_threaded_copy = $RCMAIL->config->get('message_threading', array()); |
| | | $delimiter = $IMAP->get_hierarchy_delimiter(); |
| | | $a_js_folders = $seen_folders = $list_folders = array(); |
| | | $a_js_folders = $seen = $list_folders = array(); |
| | | |
| | | // pre-process folders list |
| | | foreach ($a_unsubscribed as $i => $folder) { |
| | |
| | | $list_folders[] = array('id' => $folder, 'name' => $name, 'level' => $level); |
| | | $seen[$folder]++; |
| | | } |
| | | |
| | | unset($seen); |
| | | |
| | | // remove 'message_threading' option for not existing folders |
| | | if ($a_threaded_copy) { |
| | |
| | | $display_folder = str_repeat(' ', $folder['level']) . ($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); |
| | | $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); |
| | | |
| | | if ($folder['virtual']) |
| | | if ($folder['virtual']) { |
| | | $classes[] = 'virtual'; |
| | | } |
| | | |
| | | if (!$protected) { |
| | | $opts = $IMAP->mailbox_options($folder['id']); |
| | | $noselect = in_array('\\Noselect', $opts); |
| | | } |
| | | |
| | | $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes))); |
| | | |
| | | $table->add('name', Q($display_folder)); |
| | | $table->add('msgcount', ($folder['virtual'] ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false))); |
| | | $table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''), |
| | | array('value' => $folder_utf8, 'disabled' => $protected ? 'disabled' : ''))); |
| | | array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : ''))); |
| | | if ($threading_supported) { |
| | | $table->add('threaded', $folder['virtual'] ? '' : |
| | | $checkbox_threaded->show(($threaded ? $folder_utf8 : ''), array('value' => $folder_utf8))); |