Implement function to move Kolab objects from one folder into another

This commit is contained in:
Thomas B 2012-04-03 23:29:30 +02:00
parent 1a47608fe2
commit e18857f155
2 changed files with 27 additions and 1 deletions

View file

@ -567,7 +567,6 @@ class kolab_driver extends calendar_driver
return false;
$fromcalendar = $storage;
$storage->storage->synchronize();
}
}
else

View file

@ -467,6 +467,33 @@ class kolab_storage_folder
}
/**
* Move a Kolab object message to another IMAP folder
*
* @param string Object UID
* @param string IMAP folder to move object to
* @return boolean True on success, false on failure
*/
public function move($uid, $target_folder)
{
if ($msguid = $this->uid2msguid($uid)) {
if ($success = $this->imap->move_message($msguid, $target_folder, $this->name)) {
// TODO: update cache
return true;
}
else {
raise_error(array(
'code' => 600, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Failed to move message $msguid to $target_folder: " . $this->imap->get_error_str(),
), true);
}
}
return false;
}
/**
* Resolve an object UID into an IMAP message UID
*/