Cleanup Quota handling

This commit is contained in:
the-djmaze 2024-02-26 13:36:10 +01:00
parent 886e53bb8f
commit 9006c377fd
4 changed files with 7 additions and 18 deletions

View file

@ -50,8 +50,8 @@ trait Quota
if (!$this->hasCapability('QUOTA')) {
return null;
}
$aReturn = array(0, 0, 0, 0);
$oResponseCollection = $this->SendRequest(($root?'GETQUOTAROOT':'GETQUOTA') . " {$this->EscapeFolderName($sFolderName)}");
$aReturn = array(0, 0);
foreach ($this->yieldUntaggedResponses() as $oResponse) {
if ('QUOTA' === $oResponse->StatusOrIndex
&& isset($oResponse->ResponseList[3])

View file

@ -86,14 +86,11 @@ trait Folders
}
if ($oFolderCollection) {
$aQuota = null;
if ($this->GetCapa(Capa::QUOTA)) {
try {
// $aQuota = $this->ImapClient()->Quota();
$aQuota = $this->ImapClient()->QuotaRoot();
} catch (\Throwable $oException) {
// ignore
}
try {
// $aQuota = $this->ImapClient()->Quota();
$aQuota = $this->ImapClient()->QuotaRoot();
} catch (\Throwable $oException) {
// ignore
}
$aCapabilities = \array_values(\array_filter($this->ImapClient()->Capability() ?: [], function ($item) {

View file

@ -225,21 +225,14 @@ trait User
public function DoQuota() : array
{
$oAccount = $this->initMailClientConnection();
if (!$this->GetCapa(Capa::QUOTA)) {
return $this->DefaultResponse(array(0, 0, 0, 0));
}
try
{
$aQuota = $this->ImapClient()->QuotaRoot();
return $this->DefaultResponse($this->ImapClient()->QuotaRoot() ?: [0, 0, 0, 0]);
}
catch (\Throwable $oException)
{
throw new ClientException(Notifications::MailServerError, $oException);
}
return $this->DefaultResponse($aQuota);
}
public function DoSuggestions() : array

View file

@ -13,7 +13,6 @@ abstract class Capa
const ADDITIONAL_ACCOUNTS = 'AdditionalAccounts';
const IDENTITIES = 'Identities';
const CONTACTS = 'Contacts';
const QUOTA = 'Quota';
const ATTACHMENTS_ACTIONS = 'AttachmentsActions';
const DANGEROUS_ACTIONS = 'DangerousActions';
}