Some $this->MailClient() to $this->ImapClient()

This commit is contained in:
the-djmaze 2023-02-16 09:01:14 +01:00
parent d98a2e015e
commit 1a05a0adf2
6 changed files with 22 additions and 21 deletions

View file

@ -245,8 +245,8 @@ class Actions
public function BootEnd(): void public function BootEnd(): void
{ {
try { try {
if ($this->MailClient()->IsLoggined()) { if ($this->ImapClient()->IsLoggined()) {
$this->MailClient()->Disconnect(); $this->ImapClient()->Disconnect();
} }
} catch (\Throwable $oException) { } catch (\Throwable $oException) {
unset($oException); unset($oException);
@ -1094,9 +1094,9 @@ class Actions
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
if (!$this->MailClient()->IsLoggined()) { if (!$this->ImapClient()->IsLoggined()) {
try { try {
$oAccount->ImapConnectAndLogin($this->oPlugins, $this->MailClient()->ImapClient(), $this->oConfig); $oAccount->ImapConnectAndLogin($this->oPlugins, $this->ImapClient(), $this->oConfig);
} catch (\MailSo\Net\Exceptions\ConnectionException $oException) { } catch (\MailSo\Net\Exceptions\ConnectionException $oException) {
throw new Exceptions\ClientException(Notifications::ConnectionError, $oException); throw new Exceptions\ClientException(Notifications::ConnectionError, $oException);
} catch (\Throwable $oException) { } catch (\Throwable $oException) {

View file

@ -57,14 +57,14 @@ trait Folders
$aQuota = null; $aQuota = null;
if ($this->GetCapa(Capa::QUOTA)) { if ($this->GetCapa(Capa::QUOTA)) {
try { try {
// $aQuota = $this->MailClient()->Quota(); // $aQuota = $this->ImapClient()->Quota();
$aQuota = $this->MailClient()->QuotaRoot(); $aQuota = $this->ImapClient()->QuotaRoot();
} catch (\Throwable $oException) { } catch (\Throwable $oException) {
// ignore // ignore
} }
} }
$aCapabilities = \array_values(\array_filter($this->MailClient()->Capability(), function ($item) { $aCapabilities = \array_values(\array_filter($this->ImapClient()->Capability(), function ($item) {
return !\preg_match('/^(IMAP|AUTH|LOGIN|SASL)/', $item); return !\preg_match('/^(IMAP|AUTH|LOGIN|SASL)/', $item);
})); }));
@ -73,7 +73,7 @@ trait Folders
array( array(
'quotaUsage' => $aQuota ? $aQuota[0] * 1024 : null, 'quotaUsage' => $aQuota ? $aQuota[0] * 1024 : null,
'quotaLimit' => $aQuota ? $aQuota[1] * 1024 : null, 'quotaLimit' => $aQuota ? $aQuota[1] * 1024 : null,
'namespace' => $this->MailClient()->GetPersonalNamespace(), 'namespace' => $this->ImapClient()->GetPersonalNamespace(),
'capabilities' => $aCapabilities 'capabilities' => $aCapabilities
) )
); );
@ -109,7 +109,7 @@ trait Folders
$sFolderFullName = $this->GetActionParam('folder'); $sFolderFullName = $this->GetActionParam('folder');
$sMetadataKey = $this->GetActionParam('key'); $sMetadataKey = $this->GetActionParam('key');
if ($sFolderFullName && $sMetadataKey) { if ($sFolderFullName && $sMetadataKey) {
$this->MailClient()->FolderSetMetadata($sFolderFullName, [ $this->ImapClient()->FolderSetMetadata($sFolderFullName, [
$sMetadataKey => $this->GetActionParam('value') ?: null $sMetadataKey => $this->GetActionParam('value') ?: null
]); ]);
} }
@ -125,7 +125,7 @@ trait Folders
try try
{ {
$this->MailClient()->{$bSubscribe ? 'FolderSubscribe' : 'FolderUnsubscribe'}($sFolderFullName); $this->ImapClient()->{$bSubscribe ? 'FolderSubscribe' : 'FolderUnsubscribe'}($sFolderFullName);
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
@ -231,7 +231,7 @@ trait Folders
try try
{ {
$this->MailClient()->FolderDelete($this->GetActionParam('folder', '')); $this->ImapClient()->FolderDelete($this->GetActionParam('folder', ''));
} }
catch (\MailSo\Mail\Exceptions\NonEmptyFolder $oException) catch (\MailSo\Mail\Exceptions\NonEmptyFolder $oException)
{ {
@ -254,7 +254,7 @@ trait Folders
try try
{ {
$this->MailClient()->FolderClear($this->GetActionParam('folder', '')); $this->ImapClient()->FolderClear($this->GetActionParam('folder', ''));
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {

View file

@ -62,6 +62,7 @@ trait Messages
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
if ($sHash) { if ($sHash) {
// $oInfo = $this->MailClient()->FolderHash($oParams->sFolderName);
$oInfo = $this->ImapClient()->FolderStatusAndSelect($oParams->sFolderName); $oInfo = $this->ImapClient()->FolderStatusAndSelect($oParams->sFolderName);
$aRequestHash = \explode('-', $sHash); $aRequestHash = \explode('-', $sHash);
$sFolderHash = $oInfo->getHash($this->ImapClient()->Hash()); $sFolderHash = $oInfo->getHash($this->ImapClient()->Hash());
@ -135,7 +136,7 @@ trait Messages
$sMessageFolder = $this->GetActionParam('messageFolder', ''); $sMessageFolder = $this->GetActionParam('messageFolder', '');
$iMessageUid = (int) $this->GetActionParam('messageUid', 0); $iMessageUid = (int) $this->GetActionParam('messageUid', 0);
if (\strlen($sMessageFolder) && 0 < $iMessageUid) { if (\strlen($sMessageFolder) && 0 < $iMessageUid) {
$this->MailClient()->MessageDelete($sMessageFolder, new SequenceSet($iMessageUid)); $this->ImapClient()->MessageDelete($sMessageFolder, new SequenceSet($iMessageUid));
} }
if (null !== $iNewUid && 0 < $iNewUid) { if (null !== $iNewUid && 0 < $iNewUid) {
@ -250,7 +251,7 @@ trait Messages
if (\strlen($sDraftFolder) && 0 < $iDraftUid) { if (\strlen($sDraftFolder) && 0 < $iDraftUid) {
try try
{ {
$this->MailClient()->MessageDelete($sDraftFolder, new SequenceSet($iDraftUid)); $this->ImapClient()->MessageDelete($sDraftFolder, new SequenceSet($iDraftUid));
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
@ -452,7 +453,7 @@ trait Messages
try try
{ {
$this->MailClient()->MessageDelete($sFolder, new SequenceSet($aUids), true); $this->ImapClient()->MessageDelete($sFolder, new SequenceSet($aUids), true);
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
@ -517,7 +518,7 @@ trait Messages
try try
{ {
$this->MailClient()->MessageMove($sFromFolder, $sToFolder, $oUids); $this->ImapClient()->MessageMove($sFromFolder, $sToFolder, $oUids);
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
@ -546,7 +547,7 @@ trait Messages
try try
{ {
$this->MailClient()->MessageCopy( $this->ImapClient()->MessageCopy(
$this->GetActionParam('fromFolder', ''), $this->GetActionParam('fromFolder', ''),
$this->GetActionParam('toFolder', ''), $this->GetActionParam('toFolder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', ''))) new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', '')))
@ -651,7 +652,7 @@ trait Messages
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
$oImapClient = $this->MailClient()->ImapClient(); $oImapClient = $this->ImapClient();
$oImapClient->FolderExamine($sFolderName); $oImapClient->FolderExamine($sFolderName);
$aParts = [ $aParts = [

View file

@ -191,7 +191,7 @@ trait Response
if ($mResponse instanceof \MailSo\Imap\Folder) { if ($mResponse instanceof \MailSo\Imap\Folder) {
$aResult = $mResponse->jsonSerialize(); $aResult = $mResponse->jsonSerialize();
$sHash = $mResponse->Hash($this->MailClient()->ImapClient()->Hash()); $sHash = $mResponse->Hash($this->ImapClient()->Hash());
if ($sHash) { if ($sHash) {
$aResult['hash'] = $sHash; $aResult['hash'] = $sHash;
} }

View file

@ -228,7 +228,7 @@ trait User
try try
{ {
$aQuota = $this->MailClient()->QuotaRoot(); $aQuota = $this->ImapClient()->QuotaRoot();
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {

View file

@ -413,7 +413,7 @@ trait UserAuth
{ {
try { try {
if (!$oImapClient) { if (!$oImapClient) {
$oImapClient = $this->MailClient()->ImapClient(); $oImapClient = $this->ImapClient();
} }
$oAccount->ImapConnectAndLogin($this->Plugins(), $oImapClient, $this->Config()); $oAccount->ImapConnectAndLogin($this->Plugins(), $oImapClient, $this->Config());
} catch (ClientException $oException) { } catch (ClientException $oException) {