public function testBug13711() { $this->markTestIncomplete("Useless test without all the fixtures."); $factory = new Horde_ActiveSync_Factory_TestServer(); $imap_client = $this->getMockSkipConstructor('Horde_Imap_Client_Socket'); $imap_client->expects($this->any())->method('fetch')->will($this->_getFixturesFor13711()); $imap_factory = new Horde_ActiveSync_Stub_ImapFactory(); $imap_factory->fixture = $imap_client; $adapter = new Horde_ActiveSync_Imap_Adapter(array('factory' => $imap_factory)); $adapter->getMessages('INBOX', array(462), array('protocolversion' => 14.1, 'bodyprefs' => array('wanted' => Horde_ActiveSync::BODYPREF_TYPE_MIME, Horde_ActiveSync::BODYPREF_TYPE_MIME => array('type' => Horde_ActiveSync::BODYPREF_TYPE_MIME, 'truncationsize' => 200000)), 'mimesupport' => Horde_ActiveSync::MIME_SUPPORT_ALL)); }
/** * Check to see if we are able to send an unconfirmed MDN based on the * message data. * * @return boolean True if able to send, otherwise false. */ protected function _msgCheck() { $msgs = $this->_imap->getImapMessage($this->_mailbox, $this->_uid, array('headers' => true)); if (!count($msgs)) { return false; } $imap_msg = array_pop($msgs); $mdn = new Horde_Mime_Mdn($imap_msg->getHeaders()); if ($mdn->getMdnReturnAddr() && !$mdn->userConfirmationNeeded()) { $this->_msg = $imap_msg; return true; } return false; }
/** * Fetch data from the IMAP client. * * @param array $params Parameter array. * - html_id (string) The MIME id of the HTML part, if any. * - text_id (string) The MIME id of the plain part, if any. * * @return Horde_Imap_Client_Data_Fetch The results. */ protected function _fetchData(array $params) { $query = new Horde_Imap_Client_Fetch_Query(); $query_opts = array('decode' => true, 'peek' => true); // Get body information if ($this->_version >= Horde_ActiveSync::VERSION_TWELVE) { if (!empty($params['html_id'])) { $query->bodyPartSize($params['html_id']); $query->bodyPart($params['html_id'], $query_opts); } if (!empty($params['text_id'])) { $query->bodyPart($params['text_id'], $query_opts); $query->bodyPartSize($params['text_id']); } } else { // EAS 2.5 Plaintext body $query->bodyPart($params['text_id'], $query_opts); $query->bodyPartSize($params['text_id']); } try { $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->_uid)))); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_ActiveSync_Exception($e); } if (!($data = $fetch_ret->first())) { throw new Horde_Exception_NotFound(sprintf('Could not load message %s from server.', $this->_uid)); } return $data; }
/** * Get verb changes from the maillog. * * @param Horde_ActiveSync_Folder_Imap $folder The folder to search. * @param integer $ts The timestamp to start from. * * @return Horde_ActiveSync_Folder_Imap The folder object, with any changes * added accordingly. */ protected function _getMaillogChanges(Horde_ActiveSync_Folder_Imap $folder, $ts) { if ($ts == 0) { // For initial sync we don't need to poll for these changes since // when we send the new message, we poll the maillog for last verb // anyway. return $folder; } $changes = $this->_connector->mail_getMaillogChanges($ts); $flags = array(); $s_changes = array(); foreach ($changes as $mid) { try { $uid = $this->_imap->getUidFromMid($mid, $folder); } catch (Horde_Exception_NotFound $e) { continue; } catch (Horde_ActiveSync_Exception $e) { $this->_logger->err($e->getMessage()); continue; } $s_changes[] = $uid; $verb = $this->_getLastVerb($mid); if (!empty($verb)) { switch ($verb['action']) { case 'reply': case 'reply_list': $flags[$uid] = array(Horde_ActiveSync::CHANGE_REPLY_STATE => $verb['ts']); break; case 'reply_all': $flags[$uid] = array(Horde_ActiveSync::CHANGE_REPLYALL_STATE => $verb['ts']); break; case 'forward': $flags[$uid] = array(Horde_ActiveSync::CHANGE_FORWARD_STATE => $verb['ts']); } } } if (!empty($s_changes)) { $folder->setChanges($s_changes, $flags); } return $folder; }
/** * Fetch the source message for a SMART request from the IMAP server. * * @throws Horde_Exception_NotFound */ protected function _getImapMessage() { if (empty($this->_id) || empty($this->_parentFolder)) { return; } $this->_imapMessage = array_pop($this->_imap->getImapMessage($this->_parentFolder, $this->_id, array('headers' => true))); if (empty($this->_imapMessage)) { throw new Horde_Exception_NotFound('The forwarded/replied message was not found.'); } }