From e7c1aad83208b343634a1b857b53474c97a74f61 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 02 Mar 2013 14:29:20 -0500
Subject: [PATCH] Even better message on over quota error in move to trash operation (#1484164)
---
program/include/rcmail.php | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 667be14..30d1fe8 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -1798,39 +1798,50 @@
*
* @param string $fallback Fallback message label
* @param array $fallback_args Fallback message label arguments
+ * @param string $suffix Message label suffix
*/
- public function display_server_error($fallback = null, $fallback_args = null)
+ public function display_server_error($fallback = null, $fallback_args = null, $suffix = '')
{
$err_code = $this->storage->get_error_code();
$res_code = $this->storage->get_response_code();
+ $args = array();
if ($res_code == rcube_storage::NOPERM) {
- $this->output->show_message('errornoperm', 'error');
+ $error = 'errornoperm';
}
else if ($res_code == rcube_storage::READONLY) {
- $this->output->show_message('errorreadonly', 'error');
+ $error = 'errorreadonly';
}
else if ($res_code == rcube_storage::OVERQUOTA) {
- $this->output->show_message('errorroverquota', 'error');
+ $error = 'errorroverquota';
}
else if ($err_code && ($err_str = $this->storage->get_error_str())) {
// try to detect access rights problem and display appropriate message
if (stripos($err_str, 'Permission denied') !== false) {
- $this->output->show_message('errornoperm', 'error');
+ $error = 'errornoperm';
}
// try to detect full mailbox problem and display appropriate message
else if (stripos($err_str, 'Quota exceeded') !== false) {
- $this->output->show_message('erroroverquota', 'error');
+ $error = 'erroroverquota';
}
else {
- $this->output->show_message('servererrormsg', 'error', array('msg' => $err_str));
+ $error = 'servererrormsg';
+ $args = array('msg' => $err_str);
}
}
else if ($err_code < 0) {
- $this->output->show_message('storageerror', 'error');
+ $error = 'storageerror';
}
else if ($fallback) {
- $this->output->show_message($fallback, 'error', $fallback_args);
+ $error = $fallback;
+ $args = $fallback_args;
+ }
+
+ if ($error) {
+ if ($suffix && $this->text_exists($error . $suffix)) {
+ $error .= $suffix;
+ }
+ $this->output->show_message($error, 'error', $args);
}
}
--
Gitblit v1.9.1