From 90f81a6c8de5aecfa36c54cc5260d25ba883aa51 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 8 Dec 2010 12:52:04 +0000 Subject: - 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 --- program/include/main.inc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'program/include/main.inc') 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 @@ -1615,6 +1615,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 * -- cgit v1.2.3