/** * 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; }