summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-11-27 08:33:40 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-11-27 08:33:40 (GMT)
commitae93c7b345f8ff3cb33302472ec53a27afbc250c (patch)
tree93cd71e42b37438c82d95bd0674ba37fc94d3131 /plugins/libkolab
parent6a19ad1c6e27b079b8019805324737baf111e4d0 (diff)
downloadroundcubemail-plugins-kolab-ae93c7b345f8ff3cb33302472ec53a27afbc250c.tar.gz
Create domain-aware cache identifiers for groupware folders (#3991)
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/SQL/mysql/2014112700.sql2
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder.php2
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder_api.php22
3 files changed, 17 insertions, 9 deletions
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 d33f9d0..d6d17c8 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -97,7 +97,7 @@ class kolab_storage_folder extends kolab_storage_folder_api
}
// 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;
}
diff --git a/plugins/libkolab/lib/kolab_storage_folder_api.php b/plugins/libkolab/lib/kolab_storage_folder_api.php
index ea603b1..7280389 100644
--- a/plugins/libkolab/lib/kolab_storage_folder_api.php
+++ b/plugins/libkolab/lib/kolab_storage_folder_api.php
@@ -85,9 +85,10 @@ abstract class kolab_storage_folder_api
/**
* 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))
@@ -106,16 +107,21 @@ abstract class kolab_storage_folder_api
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;
}