mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup Quota handling
This commit is contained in:
parent
886e53bb8f
commit
9006c377fd
4 changed files with 7 additions and 18 deletions
|
|
@ -50,8 +50,8 @@ trait Quota
|
||||||
if (!$this->hasCapability('QUOTA')) {
|
if (!$this->hasCapability('QUOTA')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
$aReturn = array(0, 0, 0, 0);
|
||||||
$oResponseCollection = $this->SendRequest(($root?'GETQUOTAROOT':'GETQUOTA') . " {$this->EscapeFolderName($sFolderName)}");
|
$oResponseCollection = $this->SendRequest(($root?'GETQUOTAROOT':'GETQUOTA') . " {$this->EscapeFolderName($sFolderName)}");
|
||||||
$aReturn = array(0, 0);
|
|
||||||
foreach ($this->yieldUntaggedResponses() as $oResponse) {
|
foreach ($this->yieldUntaggedResponses() as $oResponse) {
|
||||||
if ('QUOTA' === $oResponse->StatusOrIndex
|
if ('QUOTA' === $oResponse->StatusOrIndex
|
||||||
&& isset($oResponse->ResponseList[3])
|
&& isset($oResponse->ResponseList[3])
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,12 @@ trait Folders
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oFolderCollection) {
|
if ($oFolderCollection) {
|
||||||
$aQuota = null;
|
|
||||||
if ($this->GetCapa(Capa::QUOTA)) {
|
|
||||||
try {
|
try {
|
||||||
// $aQuota = $this->ImapClient()->Quota();
|
// $aQuota = $this->ImapClient()->Quota();
|
||||||
$aQuota = $this->ImapClient()->QuotaRoot();
|
$aQuota = $this->ImapClient()->QuotaRoot();
|
||||||
} catch (\Throwable $oException) {
|
} catch (\Throwable $oException) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$aCapabilities = \array_values(\array_filter($this->ImapClient()->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);
|
||||||
|
|
|
||||||
|
|
@ -225,21 +225,14 @@ trait User
|
||||||
public function DoQuota() : array
|
public function DoQuota() : array
|
||||||
{
|
{
|
||||||
$oAccount = $this->initMailClientConnection();
|
$oAccount = $this->initMailClientConnection();
|
||||||
|
|
||||||
if (!$this->GetCapa(Capa::QUOTA)) {
|
|
||||||
return $this->DefaultResponse(array(0, 0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aQuota = $this->ImapClient()->QuotaRoot();
|
return $this->DefaultResponse($this->ImapClient()->QuotaRoot() ?: [0, 0, 0, 0]);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
throw new ClientException(Notifications::MailServerError, $oException);
|
throw new ClientException(Notifications::MailServerError, $oException);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->DefaultResponse($aQuota);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DoSuggestions() : array
|
public function DoSuggestions() : array
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ abstract class Capa
|
||||||
const ADDITIONAL_ACCOUNTS = 'AdditionalAccounts';
|
const ADDITIONAL_ACCOUNTS = 'AdditionalAccounts';
|
||||||
const IDENTITIES = 'Identities';
|
const IDENTITIES = 'Identities';
|
||||||
const CONTACTS = 'Contacts';
|
const CONTACTS = 'Contacts';
|
||||||
const QUOTA = 'Quota';
|
|
||||||
const ATTACHMENTS_ACTIONS = 'AttachmentsActions';
|
const ATTACHMENTS_ACTIONS = 'AttachmentsActions';
|
||||||
const DANGEROUS_ACTIONS = 'DangerousActions';
|
const DANGEROUS_ACTIONS = 'DangerousActions';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue