/** * move message test helper * * @param mixed $_toMove * @param Felamimail_Model_Folder $_folder */ protected function _moveTestHelper($_toMove, $_folder) { Felamimail_Controller_Message_Move::getInstance()->moveMessages($_toMove, $_folder); $message = $this->_searchMessage('multipart/mixed', $_folder); $folder = $this->_cache->updateCache($_folder, 30); while ($folder->cache_status === Felamimail_Model_Folder::CACHE_STATUS_INCOMPLETE) { $folder = $this->_cache->updateCache($folder, 30); } $result = $this->_controller->search($this->_getFilter($folder->getId())); foreach ($result as $messageInCache) { if ($messageInCache->messageuid == $message['uid']) { $foundMessage = $messageInCache; break; } } $this->assertTrue(isset($foundMessage)); $this->_createdMessages[] = $foundMessage; $completeMessage = $this->_controller->getCompleteMessage($foundMessage); $this->assertContains('The attached list notes all of the packages that were added or removed', $completeMessage->body); }
/** * get test alarm emails * * @param boolean $deleteThem * @return Tinebase_Record_RecordSet */ protected function _getAlarmMails($deleteThem = FALSE) { // search and assert alarm mail $folder = $this->_emailTestClass->getFolder('INBOX'); $folder = Felamimail_Controller_Cache_Message::getInstance()->updateCache($folder, 10, 1); $i = 0; while ($folder->cache_status != Felamimail_Model_Folder::CACHE_STATUS_COMPLETE && $i < 10) { $folder = Felamimail_Controller_Cache_Message::getInstance()->updateCache($folder, 10); $i++; } $account = Felamimail_Controller_Account::getInstance()->search()->getFirstRecord(); $filter = new Felamimail_Model_MessageFilter(array(array('field' => 'folder_id', 'operator' => 'equals', 'value' => $folder->getId()), array('field' => 'account_id', 'operator' => 'equals', 'value' => $account->getId()), array('field' => 'subject', 'operator' => 'startswith', 'value' => 'Alarm for event "Wakeup" at'))); $result = Felamimail_Controller_Message::getInstance()->search($filter); if ($deleteThem) { Felamimail_Controller_Message_Move::getInstance()->moveMessages($filter, Felamimail_Model_Folder::FOLDER_TRASH); } return $result; }
/** * move messsages to folder * * @param array $filterData filter data * @param string $targetFolderId * @return array source folder status */ public function moveMessages($filterData, $targetFolderId) { // close session to allow other requests Tinebase_Session::writeClose(true); $filter = new Felamimail_Model_MessageFilter(array()); $filter->setFromArrayInUsersTimezone($filterData); $updatedFolders = Felamimail_Controller_Message_Move::getInstance()->moveMessages($filter, $targetFolderId); $result = $updatedFolders !== NULL ? $this->_multipleRecordsToJson($updatedFolders) : array(); return $result; }
/** * (non-PHPdoc) * @see ActiveSync_Frontend_Abstract::moveItem() */ public function moveItem($srcFolderId, $serverId, $dstFolderId) { $filter = new Felamimail_Model_MessageFilter(array(array('field' => 'id', 'operator' => 'equals', 'value' => $serverId))); Felamimail_Controller_Message_Move::getInstance()->moveMessages($filter, $dstFolderId); return $serverId; }