Skip to content

Commit

Permalink
Use Horde_Stream methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 1, 2013
1 parent 44197c0 commit 15f9d3e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions framework/ActiveSync/lib/Horde/ActiveSync/Rfc822.php
Expand Up @@ -94,7 +94,7 @@ public function getMessage()
*/
public function getString()
{
rewind($this->_stream->stream);
$this->_stream->rewind();
return $this->_stream->stream;
}

Expand All @@ -105,7 +105,7 @@ public function getString()
*/
public function getHeaders()
{
rewind($this->_stream->stream);
$this->_stream->rewind();
$hdr_text = $this->_stream->getString(null, $this->_hdr_pos);
return Horde_Mime_Headers::parseHeaders($hdr_text);
}
Expand All @@ -117,7 +117,7 @@ public function getHeaders()
*/
public function getMimeObject()
{
rewind($this->_stream->stream);
$this->_stream->rewind();
$part = Horde_Mime_Part::parseMessage($this->_stream->getString());
$part->isBasePart(true);

Expand Down Expand Up @@ -147,9 +147,8 @@ public function getBytes()
protected function _findHeader()
{
$i = 0;
while (is_resource($this->_stream->stream) &&
!feof($this->_stream->stream)) {
$data = fread($this->_stream->stream, 8192);
while (!$this->_stream->eof())
$data = $this->_stream->string(null, 8192);
$hdr_pos = strpos($data, "\r\n\r\n");
if ($hdr_pos !== false) {
return array($hdr_pos + ($i * 8192), 4);
Expand All @@ -160,8 +159,8 @@ protected function _findHeader()
}
$i++;
}
fseek($this->_stream->stream, 0, SEEK_END);
return array(ftell($$this->_stream->stream), 0);
$this->_stream->end();
return array($this->_stream->pos(), 0);
}

}

0 comments on commit 15f9d3e

Please sign in to comment.