mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-09 06:28:28 +03:00
Cleanup MailSo MailClient using __call()
This commit is contained in:
parent
2c54b0caf0
commit
2ef9b22385
2 changed files with 11 additions and 60 deletions
|
|
@ -28,7 +28,7 @@ class MailClient
|
|||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
*/
|
||||
private $oLogger;
|
||||
private $oLogger = null;
|
||||
|
||||
/**
|
||||
* @var \MailSo\Imap\ImapClient
|
||||
|
|
@ -37,8 +37,6 @@ class MailClient
|
|||
|
||||
function __construct()
|
||||
{
|
||||
$this->oLogger = null;
|
||||
|
||||
$this->oImapClient = new \MailSo\Imap\ImapClient;
|
||||
$this->oImapClient->SetTimeOuts(10, \MailSo\Config::$ImapTimeout);
|
||||
}
|
||||
|
|
@ -48,31 +46,6 @@ class MailClient
|
|||
return $this->oImapClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \MailSo\RuntimeException
|
||||
* @throws \MailSo\Net\Exceptions\*
|
||||
*/
|
||||
public function Disconnect() : self
|
||||
{
|
||||
$this->oImapClient->Disconnect();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function IsConnected() : bool
|
||||
{
|
||||
return $this->oImapClient->IsConnected();
|
||||
}
|
||||
|
||||
public function IsLoggined() : bool
|
||||
{
|
||||
return $this->oImapClient->IsLoggined();
|
||||
}
|
||||
|
||||
public function Capabilities() : array
|
||||
{
|
||||
return $this->oImapClient->Capability();
|
||||
}
|
||||
|
||||
private function getEnvelopeOrHeadersRequestString() : string
|
||||
{
|
||||
if (\MailSo\Config::$MessageAllHeaders)
|
||||
|
|
@ -1016,16 +989,6 @@ class MailClient
|
|||
return $oMessageCollection;
|
||||
}
|
||||
|
||||
public function Quota(string $sRootName = '') : ?array
|
||||
{
|
||||
return $this->oImapClient->Quota($sRootName);
|
||||
}
|
||||
|
||||
public function QuotaRoot(string $sFolderName = 'INBOX') : ?array
|
||||
{
|
||||
return $this->oImapClient->QuotaRoot($sFolderName);
|
||||
}
|
||||
|
||||
public function FindMessageUidByMessageId(string $sFolderName, string $sMessageId) : ?int
|
||||
{
|
||||
if (!\strlen($sMessageId))
|
||||
|
|
@ -1297,39 +1260,27 @@ class MailClient
|
|||
/**
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function SetLogger(\MailSo\Log\Logger $oLogger) : self
|
||||
public function SetLogger(\MailSo\Log\Logger $oLogger) : void
|
||||
{
|
||||
$this->oLogger = $oLogger;
|
||||
$this->oImapClient->SetLogger($this->oLogger);
|
||||
|
||||
return $this;
|
||||
$this->oImapClient->SetLogger($oLogger);
|
||||
}
|
||||
|
||||
public function GetNamespace() : string
|
||||
public function GetPersonalNamespace() : string
|
||||
{
|
||||
$oNamespace = $this->oImapClient->GetNamespace();
|
||||
return $oNamespace ? $oNamespace->GetPersonalNamespace() : '';
|
||||
}
|
||||
|
||||
public function __call(string $name, array $arguments) /*: mixed*/
|
||||
{
|
||||
return $this->oImapClient->{$name}(...$arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* RFC 5464
|
||||
*/
|
||||
|
||||
public function ServerGetMetadata(array $aEntries, array $aOptions = []) : array
|
||||
{
|
||||
return $this->oImapClient->ServerGetMetadata($aEntries, $aOptions);
|
||||
}
|
||||
|
||||
public function FolderGetMetadata(string $sFolderName, array $aEntries, array $aOptions = []) : array
|
||||
{
|
||||
return $this->oImapClient->FolderGetMetadata($sFolderName, $aEntries, $aOptions);
|
||||
}
|
||||
|
||||
public function FolderSetMetadata(string $sFolderName, array $aEntries) : void
|
||||
{
|
||||
$this->oImapClient->FolderSetMetadata($sFolderName, $aEntries);
|
||||
}
|
||||
|
||||
public function FolderDeleteMetadata($sFolderName, array $aEntries) : void
|
||||
{
|
||||
$this->oImapClient->FolderSetMetadata($sFolderName, \array_fill_keys(\array_keys($aEntries), null));
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ trait Folders
|
|||
|
||||
if ($oFolderCollection)
|
||||
{
|
||||
$sNamespace = $this->MailClient()->GetNamespace();
|
||||
$sNamespace = $this->MailClient()->GetPersonalNamespace();
|
||||
|
||||
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, $oFolderCollection));
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ trait Folders
|
|||
}
|
||||
}
|
||||
|
||||
$aCapabilities = \array_filter($this->MailClient()->Capabilities(), function($item){
|
||||
$aCapabilities = \array_filter($this->MailClient()->Capability(), function($item){
|
||||
return !\preg_match('/^(IMAP|AUTH|LOGIN|SASL)/', $item);
|
||||
});
|
||||
if (!$this->Config()->Get('imap', 'use_list_status', true)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue