Skip to content

Commit

Permalink
Rewrite fix as it broke other tests. This fixes my issue and the brok…
Browse files Browse the repository at this point in the history
…en tests.
  • Loading branch information
bjornpost committed Mar 11, 2014
1 parent 88f4381 commit 7b42853
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Fetch/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,19 +432,16 @@ protected function processStructure($structure, $partIdentifier = null)
$attachment = new Attachment($this, $structure, $partIdentifier);
$this->attachments[] = $attachment;
} elseif ($structure->type == 0 || $structure->type == 1) {
if($partIdentifier !== null) {
$section = is_int($structure->ifsubtype) ? (string)$partIdentifier.".".$structure->ifsubtype : $partIdentifier;
$messageBody = imap_fetchbody($this->imapStream, $this->uid, $section, FT_UID);
} else {
$messageBody = imap_body($this->imapStream, $this->uid, FT_UID);
}
$messageBody = isset($partIdentifier) ?
imap_fetchbody($this->imapStream, $this->uid, $partIdentifier, FT_UID)
: imap_body($this->imapStream, $this->uid, FT_UID);

$messageBody = self::decode($messageBody, $structure->encoding);

if (!empty($parameters['charset']) && $parameters['charset'] !== self::$charset)
$messageBody = iconv($parameters['charset'], self::$charset, $messageBody);

if (strtolower($structure->subtype) == 'plain' || $structure->type == 1) {
if (strtolower($structure->subtype) === 'plain' || ($structure->type == 1 && strtolower($structure->subtype) !== 'alternative')) {
if (isset($this->plaintextMessage)) {
$this->plaintextMessage .= PHP_EOL . PHP_EOL;
} else {
Expand All @@ -453,7 +450,6 @@ protected function processStructure($structure, $partIdentifier = null)

$this->plaintextMessage .= trim($messageBody);
} else {

if (isset($this->htmlMessage)) {
$this->htmlMessage .= '<br><br>';
} else {
Expand Down

0 comments on commit 7b42853

Please sign in to comment.