summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-12-08 12:52:04 +0000
committeralecpl <alec@alec.pl>2010-12-08 12:52:04 +0000
commit90f81a6c8de5aecfa36c54cc5260d25ba883aa51 (patch)
tree474e5e9edbae20f38f928fbe30b8a6cbd465fd2a /program/include/main.inc
parent5be0d000ac8431079617e8eda2a9675b1bdbe417 (diff)
- Better support for READ-ONLY and NOPERM responses handling (#1487083)
- Add confirmation message on purge/expunge commands response - Fix CLOSE was called on unselected mailbox
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc32
1 files changed, 32 insertions, 0 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index ad0bccd48..160c835c9 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1616,6 +1616,38 @@ function rcmail_quota_content($attrib=NULL)
/**
+ * Outputs error message according to server error/response codes
+ *
+ * @param string Fallback message label
+ * @param string Fallback message label arguments
+ *
+ * @return void
+ */
+function rcmail_display_server_error($fallback=null, $fallback_args=null)
+{
+ global $RCMAIL;
+
+ $err_code = $RCMAIL->imap->get_error_code();
+ $res_code = $RCMAIL->imap->get_response_code();
+
+ if ($res_code == rcube_imap::NOPERM) {
+ $RCMAIL->output->show_message('errornoperm', 'error');
+ }
+ else if ($res_code == rcube_imap::READONLY) {
+ $RCMAIL->output->show_message('errorreadonly', 'error');
+ }
+ else if ($err_code && ($err_str = $RCMAIL->imap->get_error_str())) {
+ $RCMAIL->output->show_message('servererrormsg', 'error', array('msg' => $err_str));
+ }
+ else if ($fallback) {
+ $RCMAIL->output->show_message($fallback, 'error', $fallback_args);
+ }
+
+ return true;
+}
+
+
+/**
* Output HTML editor scripts
*
* @param string Editor mode