Small fixes

This commit is contained in:
RainLoop Team 2015-10-07 20:06:57 +03:00
parent 9b517feca3
commit c6f098bd2d
2 changed files with 31 additions and 2 deletions

View file

@ -337,6 +337,26 @@ class BodyStructure
return $aReturn;
}
/**
* @return \MailSo\Imap\BodyStructure|null
*/
public function SearchInlineEncryptedPart()
{
if ('multipart/encrypted' === \strtolower($this->ContentType()))
{
$aSearchParts = $this->SearchByCallback(function ($oItem) {
return $oItem->IsInline();
});
if (is_array($aSearchParts) && 1 === \count($aSearchParts) && isset($aSearchParts[0]))
{
return $aSearchParts[0];
}
}
return null;
}
/**
* @return array|null
*/
@ -348,6 +368,15 @@ class BodyStructure
$mResult = $this->SearchPlainParts();
}
if (null === $mResult || (\is_array($mResult) && 0 === count($mResult)))
{
$oPart = $this->SearchInlineEncryptedPart();
if ($oPart instanceof \MailSo\Imap\BodyStructure)
{
$mResult = array($oPart);
}
}
return $mResult;
}