From 90f81a6c8de5aecfa36c54cc5260d25ba883aa51 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 08 Dec 2010 07:52:04 -0500 Subject: [PATCH] - 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 files changed, 32 insertions(+), 0 deletions(-) diff --git a/program/include/main.inc b/program/include/main.inc index ad0bccd..160c835 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1616,6 +1616,38 @@ /** + * 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 -- Gitblit v1.9.1