summaryrefslogtreecommitdiff
path: root/program/steps/settings/func.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-06-17 08:03:07 +0000
committeralecpl <alec@alec.pl>2011-06-17 08:03:07 +0000
commit67975b99efc14e98181f659568ce9306d0a91cd1 (patch)
tree2cb1abceda181ef3eb078b576a1905da478498c7 /program/steps/settings/func.inc
parent3ddca3b945ecf36d799dfa9c772437a7dad62c5d (diff)
- Improved namespace roots handling in folder manager
Diffstat (limited to 'program/steps/settings/func.inc')
-rw-r--r--program/steps/settings/func.inc19
1 files changed, 17 insertions, 2 deletions
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index de9da282f..72e278364 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -790,14 +790,29 @@ function rcmail_folder_options($mailbox)
$acl = $RCMAIL->imap->get_capability('ACL');
$default_folders = (array) $RCMAIL->config->get('default_imap_folders');
+ $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+ $namespace = $RCMAIL->imap->get_namespace();
$options = array();
+ // check if the folder is a namespace prefix
+ if (!empty($namespace)) {
+ $mbox = $mailbox . $delimiter;
+ foreach ($namespace as $ns) {
+ foreach ($ns as $item) {
+ if ($item[0] === $mbox) {
+ $options['is_root'] = true;
+ break;
+ }
+ }
+ }
+ }
+
$options['name'] = $mailbox;
$options['options'] = $RCMAIL->imap->mailbox_options($mailbox, true);
$options['namespace'] = $RCMAIL->imap->mailbox_namespace($mailbox);
- $options['rights'] = $acl ? (array)$RCMAIL->imap->my_rights($mailbox) : array();
+ $options['rights'] = $acl && !$options['is_root'] ? (array)$RCMAIL->imap->my_rights($mailbox) : array();
$options['special'] = in_array($mailbox, $default_folders);
- $options['protected'] = $options['special'] && $RCMAIL->config->get('protect_default_folders');
+ $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders'));
if (is_array($options['options'])) {
foreach ($options['options'] as $opt) {