/** * testInternalInvitationReplyPreconditions * * an internal reply does not need to be processed of course */ public function testInternalInvitationReplyPreconditions() { $iMIP = $this->_getiMIP('REPLY'); $prepared = $this->_iMIPFrontend->prepareComponent($iMIP); $this->assertFalse(empty($prepared->preconditions), 'empty preconditions'); $this->assertTrue(isset($prepared->preconditions[Calendar_Model_iMIP::PRECONDITION_TOPROCESS]) || array_key_exists(Calendar_Model_iMIP::PRECONDITION_TOPROCESS, $prepared->preconditions), 'missing PRECONDITION_TOPROCESS'); }
/** * prepares an iMIP (RFC 6047) Message * * @param array $iMIP * @return array prepared iMIP part */ public function iMIPPrepare($iMIP) { $iMIPMessage = $iMIP instanceof Calendar_Model_iMIP ? $iMIP : new Calendar_Model_iMIP($iMIP); $iMIPFrontend = new Calendar_Frontend_iMIP(); $iMIPMessage->preconditionsChecked = FALSE; $iMIPFrontend->prepareComponent($iMIPMessage); $iMIPMessage->setTimezone(Tinebase_Core::getUserTimezone()); return $iMIPMessage->toArray(); }
/** * returns message prepared for json transport * - overwriten to convert recipients to array * * @param Tinebase_Record_Interface $_record * @return array record data */ protected function _recordToJson($_record) { if ($_record instanceof Felamimail_Model_Message) { foreach (array('to', 'cc', 'bcc') as $type) { if (!is_array($_record->{$type})) { if (!empty($_record->{$type})) { $exploded = explode(',', $_record->{$type}); $_record->{$type} = $exploded; } else { $_record->{$type} = array(); } } } if ($_record->preparedParts instanceof Tinebase_Record_RecordSet) { foreach ($_record->preparedParts as $preparedPart) { if ($preparedPart->preparedData instanceof Calendar_Model_iMIP) { try { $iMIPFrontend = new Calendar_Frontend_iMIP(); $iMIPFrontend->prepareComponent($preparedPart->preparedData, true); } catch (Exception $e) { Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not prepare calendar iMIP component: ' . $e->getMessage()); if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $e->getTraceAsString()); } $_record->preparedParts->removeRecord($preparedPart); } } } } } else { if ($_record instanceof Felamimail_Model_Account) { // add usernames $_record->resolveCredentials(); // imap $_record->resolveCredentials(TRUE, FALSE, TRUE); // smtp } else { if ($_record instanceof Felamimail_Model_Sieve_Vacation) { if (!$_record->mime) { $_record->reason = Tinebase_Mail::convertFromTextToHTML($_record->reason, 'felamimail-body-blockquote'); } } } } return parent::_recordToJson($_record); }