diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-09-24 10:08:10 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-09-24 10:08:10 +0300 |
commit | 704034be2dc09fb4a3971dddc838547eac5f6000 (patch) | |
tree | f52b3045cc19dcf9c505107e1363ec58ff7029cc | |
parent | 92262aa2a1481cfd8fc9e4f14d9d9887528a8455 (diff) |
Add setQuota() method
-rw-r--r-- | program/lib/Roundcube/rcube_imap_generic.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index 12546df01..92ccbef42 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -3264,6 +3264,28 @@ class rcube_imap_generic } /** + * Send the SETQUOTA command (RFC9208) + * + * @param string $root Quota root + * @param array $quota Quota limits e.g. ['storage' => 1024000'] + * + * @return bool True on success, False on failure + */ + public function setQuota($root, $quota) + { + $fn = function ($key, $value) { + return strtoupper($key) . ' ' . $value; + }; + + $quota = implode(' ', array_map($fn, array_keys($quota), $quota)); + + $result = $this->execute('SETQUOTA', [$this->escape($root), "({$quota})"], + self::COMMAND_NORESPONSE); + + return ($result == self::ERROR_OK); + } + + /** * Send the SETACL command (RFC4314) * * @param string $mailbox Mailbox name |