summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-12-17 09:16:47 +0000
committeralecpl <alec@alec.pl>2010-12-17 09:16:47 +0000
commit02491a9789d97fc321a3027847fd4ced42447cc6 (patch)
treed7d95cdd023d640a8af36c3c29b48ae0c5c553ab
parent1ce4420b7ee91c23be4e6a7f799794901f4dead7 (diff)
- Make possible to overwrite server's namespaces with imap_ns_* options
-rw-r--r--config/main.inc.php.dist1
-rw-r--r--program/include/rcube_imap.php66
2 files changed, 34 insertions, 33 deletions
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 8ce605058..e2f9aea3b 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -83,6 +83,7 @@ $rcmail_config['imap_delimiter'] = null;
// set these options. All can be strings or arrays of strings.
// Folders need to be ended with directory separator, e.g. "INBOX."
// (special directory "~" is an exception to this rule)
+// These can be used also to overwrite server's namespaces
$rcmail_config['imap_ns_personal'] = null;
$rcmail_config['imap_ns_other'] = null;
$rcmail_config['imap_ns_shared'] = null;
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 5aa23fa73..5715459a8 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -546,56 +546,56 @@ class rcube_imap
$imap_shared = $config->get('imap_ns_shared');
$imap_delimiter = $config->get('imap_delimiter');
- if ($imap_delimiter) {
- $this->delimiter = $imap_delimiter;
- }
-
if (!$this->conn)
return;
$ns = $this->conn->getNamespace();
- // NAMESPACE supported
+ // Set namespaces (NAMESPACE supported)
if (is_array($ns)) {
$this->namespace = $ns;
-
- if (empty($this->delimiter))
- $this->delimiter = $ns['personal'][0][1];
- if (empty($this->delimiter))
- $this->delimiter = $this->conn->getHierarchyDelimiter();
- if (empty($this->delimiter))
- $this->delimiter = '/';
}
- // not supported, get namespace from config
- else if ($imap_personal !== null || $imap_shared !== null || $imap_other !== null) {
- if (empty($this->delimiter))
- $this->delimiter = $this->conn->getHierarchyDelimiter();
- if (empty($this->delimiter))
- $this->delimiter = '/';
-
+ else {
$this->namespace = array(
'personal' => NULL,
'other' => NULL,
'shared' => NULL,
);
+ }
- if ($imap_personal !== null) {
- foreach ((array)$imap_personal as $dir) {
- $this->namespace['personal'][] = array($dir, $this->delimiter);
- }
+ if ($imap_delimiter) {
+ $this->delimiter = $imap_delimiter;
+ }
+ if (empty($this->delimiter)) {
+ $this->delimiter = $this->namespace['personal'][0][1];
+ }
+ if (empty($this->delimiter)) {
+ $this->delimiter = $this->conn->getHierarchyDelimiter();
+ }
+ if (empty($this->delimiter)) {
+ $this->delimiter = '/';
+ }
+
+ // Overwrite namespaces
+ if ($imap_personal !== null) {
+ $this->namespace['personal'] = NULL;
+ foreach ((array)$imap_personal as $dir) {
+ $this->namespace['personal'][] = array($dir, $this->delimiter);
}
- if ($imap_other !== null) {
- foreach ((array)$imap_other as $dir) {
- if ($dir) {
- $this->namespace['other'][] = array($dir, $this->delimiter);
- }
+ }
+ if ($imap_other !== null) {
+ $this->namespace['other'] = NULL;
+ foreach ((array)$imap_other as $dir) {
+ if ($dir) {
+ $this->namespace['other'][] = array($dir, $this->delimiter);
}
}
- if ($imap_shared !== null) {
- foreach ((array)$imap_shared as $dir) {
- if ($dir) {
- $this->namespace['shared'][] = array($dir, $this->delimiter);
- }
+ }
+ if ($imap_shared !== null) {
+ $this->namespace['shared'] = NULL;
+ foreach ((array)$imap_shared as $dir) {
+ if ($dir) {
+ $this->namespace['shared'][] = array($dir, $this->delimiter);
}
}
}