mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-10 16:58:07 +08:00
Bugfix: undefined $this->oImapResponse->ResponseList
This commit is contained in:
parent
f8f8cd0124
commit
21eaf88fd9
2 changed files with 11 additions and 26 deletions
|
@ -17,26 +17,18 @@ namespace MailSo\Imap;
|
|||
*/
|
||||
class FetchResponse
|
||||
{
|
||||
/**
|
||||
* @var \MailSo\Imap\Response
|
||||
*/
|
||||
private $oImapResponse;
|
||||
public Response $oImapResponse;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
private $aEnvelopeCache;
|
||||
private ?array $aEnvelopeCache = null;
|
||||
|
||||
function __construct(Response $oImapResponse)
|
||||
{
|
||||
$this->oImapResponse = $oImapResponse;
|
||||
$this->aEnvelopeCache = null;
|
||||
}
|
||||
|
||||
public function GetEnvelope(bool $bForce = false) : ?array
|
||||
{
|
||||
if (null === $this->aEnvelopeCache || $bForce)
|
||||
{
|
||||
if (null === $this->aEnvelopeCache || $bForce) {
|
||||
$this->aEnvelopeCache = $this->GetFetchValue(Enumerations\FetchType::ENVELOPE);
|
||||
}
|
||||
return $this->aEnvelopeCache;
|
||||
|
@ -54,13 +46,10 @@ class FetchResponse
|
|||
{
|
||||
$oResult = null;
|
||||
$aEmails = $this->GetFetchEnvelopeValue($iIndex);
|
||||
if (\is_array($aEmails) && \count($aEmails))
|
||||
{
|
||||
if (\is_array($aEmails) && \count($aEmails)) {
|
||||
$oResult = new \MailSo\Mime\EmailCollection;
|
||||
foreach ($aEmails as $aEmailItem)
|
||||
{
|
||||
if (\is_array($aEmailItem) && 4 === \count($aEmailItem))
|
||||
{
|
||||
foreach ($aEmails as $aEmailItem) {
|
||||
if (\is_array($aEmailItem) && 4 === \count($aEmailItem)) {
|
||||
$sDisplayName = \MailSo\Base\Utils::DecodeHeaderValue(
|
||||
self::findEnvelopeIndex($aEmailItem, 0, ''), $sParentCharset);
|
||||
|
||||
|
@ -70,8 +59,7 @@ class FetchResponse
|
|||
$sLocalPart = self::findEnvelopeIndex($aEmailItem, 2, '');
|
||||
$sDomainPart = self::findEnvelopeIndex($aEmailItem, 3, '');
|
||||
|
||||
if (\strlen($sLocalPart) && \strlen($sDomainPart))
|
||||
{
|
||||
if (\strlen($sLocalPart) && \strlen($sDomainPart)) {
|
||||
$oResult->append(
|
||||
new \MailSo\Mime\Email($sLocalPart.'@'.$sDomainPart, $sDisplayName)
|
||||
);
|
||||
|
@ -122,12 +110,9 @@ class FetchResponse
|
|||
{
|
||||
$bNextIsValue = false;
|
||||
|
||||
if (isset($this->oImapResponse->ResponseList[3]) && \is_array($this->oImapResponse->ResponseList[3]))
|
||||
{
|
||||
foreach ($this->oImapResponse->ResponseList[3] as $mItem)
|
||||
{
|
||||
if ($bNextIsValue)
|
||||
{
|
||||
if (isset($this->oImapResponse->ResponseList[3]) && \is_array($this->oImapResponse->ResponseList[3])) {
|
||||
foreach ($this->oImapResponse->ResponseList[3] as $mItem) {
|
||||
if ($bNextIsValue) {
|
||||
return (string) $mItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ class MailClient
|
|||
foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) {
|
||||
$id = $oRange->UID
|
||||
? $oFetchResponseItem->GetFetchValue(FetchType::UID)
|
||||
: $this->oImapResponse->ResponseList[1];
|
||||
: $oFetchResponseItem->oImapResponse->ResponseList[1];
|
||||
$aCollection[$id] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem);
|
||||
}
|
||||
$oMessageCollection->exchangeArray(\array_values(\array_filter($aCollection)));
|
||||
|
|
Loading…
Reference in a new issue