diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 15284960e..ed2667a08 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -155,7 +155,7 @@ class ImapClient extends \MailSo\Net\NetClient try { - if (0 === \strpos($type, 'SCRAM-SHA-')) + if (0 === \strpos($type, 'SCRAM-')) { $sAuthzid = $this->getResponseValue($this->SendRequestGetResponse('AUTHENTICATE', array($type)), Enumerations\ResponseType::CONTINUATION); $this->sendRaw($SASL->authenticate($sLogin, $sPassword/*, $sAuthzid*/), true); @@ -759,7 +759,7 @@ class ImapClient extends \MailSo\Net\NetClient private function simpleESearchOrESortHelper(bool $bSort = false, string $sSearchCriterias = 'ALL', array $aSearchOrSortReturn = null, bool $bReturnUid = true, string $sLimit = '', string $sCharset = '', array $aSortTypes = null) : array { $sCommandPrefix = ($bReturnUid) ? 'UID ' : ''; - $sSearchCriterias = 0 === \strlen($sSearchCriterias) || '*' === $sSearchCriterias + $sSearchCriterias = !\strlen($sSearchCriterias) || '*' === $sSearchCriterias ? 'ALL' : $sSearchCriterias; $sCmd = $bSort ? 'SORT': 'SEARCH'; @@ -939,7 +939,7 @@ class ImapClient extends \MailSo\Net\NetClient */ public function MessageCopy(string $sToFolder, string $sIndexRange, bool $bIndexIsUid) : self { - if (0 === \strlen($sIndexRange)) + if (!\strlen($sIndexRange)) { $this->writeLogException( new \MailSo\Base\Exceptions\InvalidArgumentException, @@ -959,7 +959,7 @@ class ImapClient extends \MailSo\Net\NetClient */ public function MessageMove(string $sToFolder, string $sIndexRange, bool $bIndexIsUid) : self { - if (0 === \strlen($sIndexRange)) + if (!\strlen($sIndexRange)) { $this->writeLogException( new \MailSo\Base\Exceptions\InvalidArgumentException, diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ResponseCollection.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ResponseCollection.php index 4af7a2f8e..3b5788b8e 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ResponseCollection.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ResponseCollection.php @@ -180,7 +180,7 @@ class ResponseCollection extends \MailSo\Base\Collection $sDelimiter = $oFolder->Delimiter(); } - $aReturn[] = $oFolder; + $aReturn[$sFullNameRaw] = $oFolder; } catch (\MailSo\Base\Exceptions\InvalidArgumentException $oException) { @@ -197,8 +197,8 @@ class ResponseCollection extends \MailSo\Base\Collection } } - if (!$bInbox && !empty($sDelimiter)) { - $aReturn[] = new Folder('INBOX', $sDelimiter); + if (!$bInbox && !empty($sDelimiter) && !isset($aReturn['INBOX'])) { + $aReturn['INBOX'] = new Folder('INBOX', $sDelimiter); } if ($bUseListStatus) { @@ -208,11 +208,8 @@ class ResponseCollection extends \MailSo\Base\Collection isset($oResponse->ResponseList[2])) { $sFolderNameRaw = $oResponse->ResponseList[2]; - foreach ($aReturn as $oFolder) { - if ($oFolder && $sFolderNameRaw === $oFolder->FullNameRaw()) { - $oFolder->setStatusFromResponse($oResponse); - break; - } + if (isset($aReturn[$sFolderNameRaw])) { + $aReturn[$sFolderNameRaw]->setStatusFromResponse($oResponse); } } } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/ResponseParser.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/ResponseParser.php index 1f99b6114..11a894842 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/ResponseParser.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/ResponseParser.php @@ -492,7 +492,7 @@ trait ResponseParser { $bCountTwoInited = true; - $oImapResponse->StatusOrIndex = strtoupper($aList[1]); + $oImapResponse->StatusOrIndex = \strtoupper($aList[1]); if ($oImapResponse->StatusOrIndex == ResponseStatus::OK || $oImapResponse->StatusOrIndex == ResponseStatus::NO || diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index 49540ae23..8674566fe 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -1976,14 +1976,13 @@ class MailClient throw new \MailSo\Base\Exceptions\InvalidArgumentException; } - $aFolders = $this->oImapClient->FolderList('', $sPrevFolderFullNameRaw); - if (!$aFolders) + $sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sPrevFolderFullNameRaw); + if (!$sDelimiter) { // TODO: Translate throw new Exceptions\RuntimeException('Cannot '.($bRename?'rename':'move').' non-existent folder.'); } - $sDelimiter = $aFolders[0]->Delimiter(); $iLast = \strrpos($sPrevFolderFullNameRaw, $sDelimiter); $aSubscribeFolders = array();