From 704034be2dc09fb4a3971dddc838547eac5f6000 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 24 Sep 2022 09:08:10 +0200 Subject: Add setQuota() method --- program/lib/Roundcube/rcube_imap_generic.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 @@ -3263,6 +3263,28 @@ class rcube_imap_generic return $result; } + /** + * 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) * -- cgit v1.2.3