Move utility function to libkolab for common use
This commit is contained in:
parent
44b67121b7
commit
854779406d
2 changed files with 20 additions and 19 deletions
|
@ -355,6 +355,24 @@ class kolab_storage_config
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Build array of member URIs from set of messages
|
||||||
*
|
*
|
||||||
|
|
|
@ -825,7 +825,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
private function get_links($uid)
|
private function get_links($uid)
|
||||||
{
|
{
|
||||||
$config = kolab_storage_config::get_instance();
|
$config = kolab_storage_config::get_instance();
|
||||||
return array_map(array($this, '_convert_message_uri'), $config->get_object_links($uid));
|
return array_map(array('kolab_storage_config','local_message_uri'), $config->get_object_links($uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -855,23 +855,6 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
return $config->save_object_links($uid, $links, $remove);
|
return $config->save_object_links($uid, $links, $remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Simplify the given message URI by converting the mailbox
|
|
||||||
* part into a relative IMAP path valid for the current user.
|
|
||||||
*/
|
|
||||||
protected function _convert_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract uid + list identifiers from the given input
|
* Extract uid + list identifiers from the given input
|
||||||
*
|
*
|
||||||
|
@ -1296,7 +1279,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
public function get_message_uri($headers, $folder)
|
public function get_message_uri($headers, $folder)
|
||||||
{
|
{
|
||||||
$uri = kolab_storage_config::get_message_uri($headers, $folder);
|
$uri = kolab_storage_config::get_message_uri($headers, $folder);
|
||||||
return $this->_convert_message_uri($uri);
|
return kolab_storage_config::local_message_uri($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue