Example #1
0
 /**
  * Return the full message text.
  *
  * @param boolean $stream  Return data as a stream?
  *
  * @return mixed  A string or stream resource.
  * @throws Horde_ActiveSync_Exception
  */
 public function getFullMsg($stream = false)
 {
     // First see if we already have it.
     if ($stream) {
         $full = new Horde_Stream_Existing(array('stream' => $this->_data->getFullMsg($stream)));
         $length = $full->length();
         if (!$length) {
             $full->close();
         }
     } else {
         $full = $this->_data->getFullMsg(false);
         $length = strlen($full);
     }
     if (!$length) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->fullText(array('peek' => true));
         try {
             $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->uid))));
         } catch (Horde_Imap_Exception $e) {
             throw new Horde_ActiveSync_Exception($e);
         }
         $data = $fetch_ret[$this->uid];
         $full = $data->getFullMsg($stream);
     }
     return $full;
 }
Example #2
0
 /**
  * Return the full message text.
  *
  * @param boolean $stream  Return data as a stream?
  *
  * @return mixed  A string or stream resource.
  * @throws Horde_ActiveSync_Exception
  */
 public function getFullMsg($stream = false)
 {
     // First see if we already have it.
     if (!($full = $this->_data->getFullMsg())) {
         $query = new Horde_Imap_Client_Fetch_Query();
         $query->fullText(array('peek' => true));
         try {
             $fetch_ret = $this->_imap->fetch($this->_mbox, $query, array('ids' => new Horde_Imap_Client_Ids(array($this->_uid))));
         } catch (Horde_Imap_Exception $e) {
             throw new Horde_ActiveSync_Exception($e);
         }
         $data = $fetch_ret[$this->_uid];
         $full = $data->getFullMsg($stream);
     }
     return $full;
 }