From 8f53e3d9f173e030079b85af1f296b5be184585b Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 15 Jun 2018 15:49:34 +0200 Subject: [PATCH] * Mail: warn user when there's no space left for storing sieve rules because of sieve_maxscriptsize limit --- api/src/Mail/Script.php | 5 +++++ mail/inc/class.mail_sieve.inc.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/Mail/Script.php b/api/src/Mail/Script.php index 787138c4c6..af4ef589cc 100644 --- a/api/src/Mail/Script.php +++ b/api/src/Mail/Script.php @@ -607,7 +607,12 @@ class Script //error_log(__METHOD__.__LINE__.array2string($newscript)); //print "
$newscript
"; exit; //print "
".htmlentities($newscript)."

"; + try { + if (!$connection->hasSpace($this->name, mb_strlen($newscript))) + { + throw new \Exception(lang("There is no space left to store sieve script, please check sieve_maxscriptsize option on your mailserver's config.")); + } $connection->installScript($this->name, $newscript, true); } catch (\Exception $e) { diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index d85be88d30..dcc91fe8fc 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -963,7 +963,7 @@ class mail_sieve if($result) { - $response->error($result); + $response->message($result); return; } $this->saveSessionData(); @@ -1170,7 +1170,7 @@ class mail_sieve { if (!$this->account->imapServer()->setRules($this->rules)) { - return "update failed"; + return $this->account->imapServer()->error; } }