Merge branch 'master' of github.com:the-djmaze/snappymail

This commit is contained in:
djmaze 2021-08-27 11:22:39 +02:00
commit 79d58ee45b
2 changed files with 28 additions and 20 deletions

View file

@ -70,7 +70,14 @@ class Redis implements \MailSo\Cache\DriverInterface
public function Set(string $sKey, string $sValue) : bool public function Set(string $sKey, string $sValue) : bool
{ {
return $this->oRedis ? $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue) : false; if (!$this->oRedis)
{
return false;
}
$sValue = $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue);
return $sValue === true || $sValue == 'OK';
} }
public function Get(string $sKey) : string public function Get(string $sKey) : string

View file

@ -46,7 +46,8 @@ class MailClient
* @throws \MailSo\Imap\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception
*/ */
public function Connect(string $sServerName, int $iPort = 143, public function Connect(string $sServerName, int $iPort = 143,
int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, bool $bVerifySsl = false, bool $bAllowSelfSigned = false, string $sClientCert = '') : self int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, bool $bVerifySsl = false,
bool $bAllowSelfSigned = false, string $sClientCert = '') : self
{ {
$this->oImapClient->Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned, $sClientCert); $this->oImapClient->Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned, $sClientCert);
return $this; return $this;
@ -357,8 +358,8 @@ class MailClient
$aFetchResponse = $this->oImapClient->Fetch(array( $aFetchResponse = $this->oImapClient->Fetch(array(
\strlen($sMimeIndex) \strlen($sMimeIndex)
? \MailSo\Imap\Enumerations\FetchType::BODY_PEEK.'['.$sMimeIndex.'.MIME]' ? \MailSo\Imap\Enumerations\FetchType::BODY_PEEK.'['.$sMimeIndex.'.MIME]'
: \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK : \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK),
), $iIndex, $bIndexIsUid); $iIndex, $bIndexIsUid);
if (\count($aFetchResponse)) if (\count($aFetchResponse))
{ {
@ -2099,8 +2100,8 @@ class MailClient
// TODO: Translate // TODO: Translate
throw new \MailSo\Mail\Exceptions\RuntimeException( throw new \MailSo\Mail\Exceptions\RuntimeException(
\strlen($sFolderParentFullNameRaw) \strlen($sFolderParentFullNameRaw)
? 'Cannot create folder in non-existen parent folder' ? 'Cannot create folder in non-existent parent folder.'
: 'Cannot get folder delimiter'); : 'Cannot get folder delimiter.');
} }
$sDelimiter = $aFolders[0]->Delimiter(); $sDelimiter = $aFolders[0]->Delimiter();
@ -2118,7 +2119,7 @@ class MailClient
{ {
// TODO: Translate // TODO: Translate
throw new \MailSo\Mail\Exceptions\RuntimeException( throw new \MailSo\Mail\Exceptions\RuntimeException(
'New folder name contains delimiter'); 'New folder name contains delimiter.');
} }
$sFullNameRawToCreate = $sFolderParentFullNameRaw.$sFullNameRawToCreate; $sFullNameRawToCreate = $sFolderParentFullNameRaw.$sFullNameRawToCreate;
@ -2163,7 +2164,7 @@ class MailClient
if (!$aFolders) if (!$aFolders)
{ {
// TODO: Translate // TODO: Translate
throw new \MailSo\Mail\Exceptions\RuntimeException('Cannot '.($bRename?'rename':'move').' non-existen folder'); throw new \MailSo\Mail\Exceptions\RuntimeException('Cannot '.($bRename?'rename':'move').' non-existent folder.');
} }
$sDelimiter = $aFolders[0]->Delimiter(); $sDelimiter = $aFolders[0]->Delimiter();
@ -2188,7 +2189,7 @@ class MailClient
if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter)) if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter))
{ {
// TODO: Translate // TODO: Translate
throw new \MailSo\Mail\Exceptions\RuntimeException('New folder name contains delimiter'); throw new \MailSo\Mail\Exceptions\RuntimeException('New folder name contains delimiter.');
} }
$sFolderParentFullNameRaw = false === $iLast ? '' : \substr($sPrevFolderFullNameRaw, 0, $iLast + 1); $sFolderParentFullNameRaw = false === $iLast ? '' : \substr($sPrevFolderFullNameRaw, 0, $iLast + 1);