/**
  * set vacation for account
  * 
  * @param Expressomail_Model_Sieve_Vacation $_vacation
  * @return Expressomail_Model_Sieve_Vacation
  * @throws Tinebase_Exception_AccessDenied
  */
 public function setVacation(Expressomail_Model_Sieve_Vacation $_vacation)
 {
     $account = Expressomail_Controller_Account::getInstance()->get($_vacation->getId());
     if ($account->user_id !== Tinebase_Core::getUser()->getId()) {
         throw new Tinebase_Exception_AccessDenied('It is not allowed to set the vacation message of another user.');
     }
     $this->_setSieveBackendAndAuthenticate($account);
     $this->_addVacationUserData($_vacation, $account);
     $this->_checkCapabilities($_vacation);
     $this->_addVacationSubject($_vacation);
     $fsv = $_vacation->getFSV();
     $script = $this->_getSieveScript($account);
     if ($script === NULL) {
         $script = $this->_createNewSieveScript($account);
     }
     $script->setVacation($fsv);
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Put updated vacation SIEVE script ' . $this->_scriptName);
     }
     $this->_putScript($account, $script);
     Expressomail_Controller_Account::getInstance()->setVacationActive($account, $_vacation->enabled);
     return $this->getVacation($account);
 }
 /**
  * persist vacation data in db
  */
 protected function _saveVacation()
 {
     if (empty($this->_vacation)) {
         return;
     }
     $vacationRecord = new Expressomail_Model_Sieve_Vacation();
     $vacationRecord->setFromFSV($this->_vacation);
     $vacationRecord->account_id = $this->_accountId;
     $vacationRecord->setId($this->_accountId);
     $vacationRecord->addresses = Zend_Json::encode($vacationRecord->addresses);
     try {
         $oldVac = $this->_vacationBackend->get($vacationRecord->getId());
         $this->_vacationBackend->update($vacationRecord);
     } catch (Tinebase_Exception_NotFound $tenf) {
         $this->_vacationBackend->create($vacationRecord);
     }
 }