diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-06-23 17:43:44 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-06-23 17:43:44 +0000 |
| commit | 22357f3ba8e7f20217d3dccf2fe797f4a783200d (patch) | |
| tree | 6220913379205c2f0e54e5c8f535a02d22ad22dd /roundcubemail/program/include/rcube_imap.php | |
| parent | 5f171b416e64a06098f4f872eda1b5c5c4c340a3 (diff) | |
- Add rcube_imap::mailbox_info()
git-svn-id: https://svn.roundcube.net/trunk@4875 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 31f196d4a..e1da538da 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -3489,6 +3489,62 @@ class rcube_imap /** + * Returns extended information about the folder + * + * @param string $mailbox Folder name + * + * @return array Data + */ + function mailbox_info($mailbox) + { + $acl = $this->get_capability('ACL'); + $namespace = $this->get_namespace(); + $options = array(); + + // check if the folder is a namespace prefix + if (!empty($namespace)) { + $mbox = $mailbox . $this->delimiter; + foreach ($namespace as $ns) { + foreach ($ns as $item) { + if ($item[0] === $mbox) { + $options['is_root'] = true; + break; + } + } + } + } + + $options['name'] = $mailbox; + $options['options'] = $this->mailbox_options($mailbox, true); + $options['namespace'] = $this->mailbox_namespace($mailbox); + $options['rights'] = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); + $options['special'] = in_array($mailbox, $this->default_folders); + + if (is_array($options['options'])) { + foreach ($options['options'] as $opt) { + $opt = strtolower($opt); + if ($opt == '\noselect' || $opt == '\nonexistent') { + $options['noselect'] = true; + } + } + } + else { + $options['noselect'] = true; + } + + if (!empty($options['rights'])) { + $options['norename'] = !in_array('x', $options['rights']) && + (!in_array('c', $options['rights']) || !in_array('d', $options['rights'])); + if (!$options['noselect']) { + $options['noselect'] = !in_array('r', $options['rights']); + } + } + + return $options; + } + + + /** * Get message header names for rcube_imap_generic::fetchHeader(s) * * @return string Space-separated list of header names |
