mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Merge quota requests into folders request
This commit is contained in:
parent
20eb01de08
commit
8d3bcdc2f2
9 changed files with 45 additions and 51 deletions
|
|
@ -743,7 +743,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
* /
|
||||
*/
|
||||
public function Quota(string $sRootName = '') : ?array
|
||||
{
|
||||
if ($this->IsSupported('QUOTA'))
|
||||
|
|
@ -753,7 +753,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* https://datatracker.ietf.org/doc/html/rfc2087#section-4.3
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ class FolderCollection extends \MailSo\Base\Collection
|
|||
*/
|
||||
public $SystemFolders = array();
|
||||
|
||||
public $quotaUsage = 0;
|
||||
public $quotaLimit = 0;
|
||||
|
||||
public function append($oFolder, bool $bToTop = false) : void
|
||||
{
|
||||
assert($oFolder instanceof Folder);
|
||||
|
|
@ -149,6 +152,8 @@ class FolderCollection extends \MailSo\Base\Collection
|
|||
'IsThreadsSupported' => $this->IsThreadsSupported,
|
||||
'IsSortSupported' => $this->IsSortSupported,
|
||||
'IsListStatusSupported' => $this->IsListStatusSupported,
|
||||
'quotaUsage' => $this->quotaUsage,
|
||||
'quotaLimit' => $this->quotaLimit,
|
||||
'Optimized' => $this->Optimized,
|
||||
'CountRec' => $this->CountRec(),
|
||||
'SystemFolders' => empty($this->SystemFolders) ? null : $this->SystemFolders
|
||||
|
|
|
|||
|
|
@ -1771,6 +1771,11 @@ 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);
|
||||
|
|
|
|||
|
|
@ -12,11 +12,27 @@ trait Folders
|
|||
|
||||
private function getFolderCollection(bool $HideUnsubscribed) : ?\MailSo\Mail\FolderCollection
|
||||
{
|
||||
return $this->MailClient()->Folders('', '*',
|
||||
$oFolderCollection = $this->MailClient()->Folders('', '*',
|
||||
$HideUnsubscribed,
|
||||
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200),
|
||||
(bool) $this->Config()->Get('labs', 'imap_use_list_status', true)
|
||||
);
|
||||
|
||||
if ($oFolderCollection) {
|
||||
$oAccount = $this->getAccountFromToken();
|
||||
if ($this->GetCapa(false, Capa::QUOTA, $oAccount)) {
|
||||
try {
|
||||
$aQuota = $this->MailClient()->Quota();
|
||||
// $aQuota = $this->MailClient()->QuotaRoot();
|
||||
$oFolderCollection->quotaUsage = $aQuota[0] * 1024;
|
||||
$oFolderCollection->quotaLimit = $aQuota[1] * 1024;
|
||||
} catch (\Throwable $oException) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $oFolderCollection;
|
||||
}
|
||||
|
||||
public function DoFolders() : array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue