From 8608c18bbed594b98e466f7e8b72de9594c1b303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Wed, 25 Aug 2021 17:19:25 +0200 Subject: [PATCH 1/2] [snappymail] Fix some confusing indentation --- .../app/libraries/MailSo/Mail/MailClient.php | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) 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 93d4b0a0d..0fe728c74 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 @@ -46,7 +46,8 @@ class MailClient * @throws \MailSo\Imap\Exceptions\Exception */ 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); return $this; @@ -357,8 +358,8 @@ class MailClient $aFetchResponse = $this->oImapClient->Fetch(array( \strlen($sMimeIndex) ? \MailSo\Imap\Enumerations\FetchType::BODY_PEEK.'['.$sMimeIndex.'.MIME]' - : \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK - ), $iIndex, $bIndexIsUid); + : \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK), + $iIndex, $bIndexIsUid); if (\count($aFetchResponse)) { @@ -2179,21 +2180,21 @@ class MailClient } } - $sNewFolderFullNameRaw = \MailSo\Base\Utils::ConvertEncoding($sNextFolderNameInUtf, - \MailSo\Base\Enumerations\Charset::UTF_8, - \MailSo\Base\Enumerations\Charset::UTF_7_IMAP); + $sNewFolderFullNameRaw = \MailSo\Base\Utils::ConvertEncoding($sNextFolderNameInUtf, + \MailSo\Base\Enumerations\Charset::UTF_8, + \MailSo\Base\Enumerations\Charset::UTF_7_IMAP); - if ($bRename) - { - if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter)) - { + if ($bRename) + { + if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter)) + { // 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); - $sNewFolderFullNameRaw = $sFolderParentFullNameRaw.$sNewFolderFullNameRaw; - } + $sFolderParentFullNameRaw = false === $iLast ? '' : \substr($sPrevFolderFullNameRaw, 0, $iLast + 1); + $sNewFolderFullNameRaw = $sFolderParentFullNameRaw.$sNewFolderFullNameRaw; + } $this->oImapClient->FolderRename($sPrevFolderFullNameRaw, $sNewFolderFullNameRaw); From 691300da5156ba084eb591b418419f4a2831d3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Wed, 25 Aug 2021 17:23:57 +0200 Subject: [PATCH 2/2] [snappymail] Clean up exception descriptions in MailClient.php The messages are currently shown in the main UI as e.g.: Can't create folder. New folder name contains delimiter Including a period (which seems to be the preferred style in other source files) means that the error message would read: Can't create folder. New folder name contains delimiter. Also fix two typos. --- .../v/0.0.0/app/libraries/MailSo/Mail/MailClient.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 0fe728c74..1ab0ee534 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 @@ -2100,8 +2100,8 @@ class MailClient // TODO: Translate throw new \MailSo\Mail\Exceptions\RuntimeException( \strlen($sFolderParentFullNameRaw) - ? 'Cannot create folder in non-existen parent folder' - : 'Cannot get folder delimiter'); + ? 'Cannot create folder in non-existent parent folder.' + : 'Cannot get folder delimiter.'); } $sDelimiter = $aFolders[0]->Delimiter(); @@ -2119,7 +2119,7 @@ class MailClient { // TODO: Translate throw new \MailSo\Mail\Exceptions\RuntimeException( - 'New folder name contains delimiter'); + 'New folder name contains delimiter.'); } $sFullNameRawToCreate = $sFolderParentFullNameRaw.$sFullNameRawToCreate; @@ -2164,7 +2164,7 @@ class MailClient if (!$aFolders) { // 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(); @@ -2189,7 +2189,7 @@ class MailClient if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullNameRaw, $sDelimiter)) { // 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);