/**
* Move message
*
* @param string $folderid Existing folder id.
* @param array $ids Message UIDs to move. @todo For H6 this
* should take a single id. We can't bulk
* move them for other reasons.
* @param string $newfolderid The new folder id to move to.
*
* @return array An array of successfully moved messages with
* the old UIDs as keys and new UIDs as values.
*
* @throws Horde_ActiveSync_Exception
*/
public function moveMessage($folderid, array $ids, $newfolderid)
{
$this->_logger->info(sprintf("[%s] Horde_Core_ActiveSync_Driver::moveMessage(%s, [%s], %s)", $this->_pid, $folderid, implode(',', $ids), $newfolderid));
$parts = $this->_parseFolderId($folderid);
if (is_array($parts)) {
$folder_class = $parts[self::FOLDER_PART_CLASS];
$folder_id = $parts[self::FOLDER_PART_ID];
} else {
$folder_class = $parts;
$folder_id = null;
}
$move_res = array();
ob_start();
switch ($folder_class) {
case Horde_ActiveSync::CLASS_CALENDAR:
$parts = $this->_parseFolderId($newfolderid);
if (is_array($parts)) {
$newfolderid = $parts[self::FOLDER_PART_ID];
}
if ($res = $this->_connector->calendar_move(array_pop($ids), $folder_id, $newfolderid)) {
$move_res[$res] = $res;
}
break;
case Horde_ActiveSync::CLASS_CONTACTS:
case Horde_ActiveSync::CLASS_TASKS:
case Horde_ActiveSync::CLASS_NOTES:
$this->_endBuffer();
// Not supported, so just drop through to return the empty array.
break;
default:
$move_res = $this->_imap->moveMessage($folderid, $ids, $newfolderid);
}
$this->_endBuffer();
return $move_res;
}