Branch 'roundcubemail-plugins-kolab-3.1' - plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Tue Dec 23 17:04:53 CET 2014
plugins/libkolab/SQL/mysql/2014112700.sql | 2 ++
plugins/libkolab/lib/kolab_storage_folder.php | 24 +++++++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
New commits:
commit f0a3f9cdf8ced773f70f837ea0dd47e4427cec83
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Nov 27 09:51:45 2014 +0100
Create domain-aware cache identifiers for groupware folders (#3991)
diff --git a/plugins/libkolab/SQL/mysql/2014112700.sql b/plugins/libkolab/SQL/mysql/2014112700.sql
new file mode 100644
index 0000000..90c77b8
--- /dev/null
+++ b/plugins/libkolab/SQL/mysql/2014112700.sql
@@ -0,0 +1,2 @@
+-- delete cache entries for old folder identifiers
+DELETE FROM `kolab_folders` WHERE `resource` LIKE 'imap://anonymous@%';
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index e6a0d9e..11ad287 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -144,9 +144,10 @@ class kolab_storage_folder
/**
* Returns the owner of the folder.
*
+ * @param boolean Return a fully qualified owner name (i.e. including domain for shared folders)
* @return string The owner of this folder.
*/
- public function get_owner()
+ public function get_owner($fully_qualified = false)
{
// return cached value
if (isset($this->owner))
@@ -165,16 +166,21 @@ class kolab_storage_folder
break;
default:
- list($prefix, $user) = explode($this->imap->get_hierarchy_delimiter(), $info['name']);
- if (strpos($user, '@') === false) {
- $domain = strstr($rcmail->get_user_name(), '@');
- if (!empty($domain))
- $user .= $domain;
- }
- $this->owner = $user;
+ list($prefix, $this->owner) = explode($this->imap->get_hierarchy_delimiter(), $info['name']);
+ $fully_qualified = true; // enforce email addresses (backwards compatibility)
break;
}
+ if ($fully_qualified && strpos($this->owner, '@') === false) {
+ // extract domain from current user name
+ $domain = strstr($rcmail->get_user_name(), '@');
+ // fall back to mail_domain config option
+ if (empty($domain) && ($mdomain = $rcmail->config->mail_domain($this->imap->options['host']))) {
+ $domain = '@' . $mdomain;
+ }
+ $this->owner .= $domain;
+ }
+
return $this->owner;
}
@@ -260,7 +266,7 @@ class kolab_storage_folder
}
// compose fully qualified ressource uri for this instance
- $this->resource_uri = 'imap://' . urlencode($this->get_owner()) . '@' . $this->imap->options['host'] . '/' . $subpath;
+ $this->resource_uri = 'imap://' . urlencode($this->get_owner(true)) . '@' . $this->imap->options['host'] . '/' . $subpath;
return $this->resource_uri;
}
More information about the commits
mailing list