summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-01-13 21:19:52 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-01-13 21:19:52 (GMT)
commit0a51ccd5a44882e84c0f14cf41e5c0bc790fb469 (patch)
tree1306248a286becc2b0f674da3ab88420607253f5 /plugins/libkolab
parent0dc0490ba02ebc695f7efd027f2b2af6f55ef1e1 (diff)
downloadroundcubemail-plugins-kolab-0a51ccd5a44882e84c0f14cf41e5c0bc790fb469.tar.gz
Consolidate message reference handling functions into libkolab plugin (in preparation for #4161)
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/lib/kolab_storage_config.php44
1 files changed, 26 insertions, 18 deletions
diff --git a/plugins/libkolab/lib/kolab_storage_config.php b/plugins/libkolab/lib/kolab_storage_config.php
index 59c191d..036b827 100644
--- a/plugins/libkolab/lib/kolab_storage_config.php
+++ b/plugins/libkolab/lib/kolab_storage_config.php
@@ -356,24 +356,6 @@ class kolab_storage_config
}
/**
- * Simplify the given message URI by converting the mailbox
- * part into a relative IMAP path valid for the current user.
- */
- public static function local_message_uri($uri)
- {
- if (strpos($uri, 'imap:///') === 0) {
- $linkref = kolab_storage_config::parse_member_url($uri);
-
- return 'imap:///' . implode('/', array_map('rawurlencode', explode('/', $linkref['folder']))) .
- '/' . $linkref['uid'] .
- '?' . http_build_query($linkref['params'], '', '&');
- }
-
- return $uri;
- }
-
-
- /**
* Build array of member URIs from set of messages
*
* @param string $folder Folder name
@@ -855,4 +837,30 @@ class kolab_storage_config
return self::build_member_url($params);
}
+
+ /**
+ * Resolve the email message reference from the given URI
+ */
+ public function get_message_reference($uri, $rel = null)
+ {
+ if ($linkref = self::parse_member_url($uri)) {
+ $linkref['subject'] = $linkref['params']['subject'];
+ $linkref['uri'] = $uri;
+
+ $rcmail = rcube::get_instance();
+ if (method_exists($rcmail, 'url')) {
+ $linkref['mailurl'] = $rcmail->url(array(
+ 'task' => 'mail',
+ 'action' => 'show',
+ 'mbox' => $linkref['folder'],
+ 'uid' => $linkref['uid'],
+ 'rel' => $rel,
+ ));
+ }
+
+ unset($linkref['params']);
+ }
+
+ return $linkref;
+ }
}