From 64e3e80743415e5fb121eb5c66416593c38ef288 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 08 Jun 2010 08:46:05 -0400
Subject: [PATCH] - Fix some IMAP errors handling when opening the message (#1485443)

---
 program/steps/mail/headers.inc |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc
index 946a688..aa10655 100644
--- a/program/steps/mail/headers.inc
+++ b/program/steps/mail/headers.inc
@@ -20,28 +20,31 @@
 
 if ($uid = get_input_value('_uid', RCUBE_INPUT_POST))
 {
-  $source = $IMAP->get_raw_headers($uid);
+    $source = $IMAP->get_raw_headers($uid);
 
-  if ($source)
-    {
-    $source = htmlspecialchars(trim($source));
-    $source = preg_replace(
-      array(
-        '/\n[\t\s]+/',
-        '/^([a-z0-9_:-]+)/im',
-        '/\r?\n/'
-      ),
-      array(
-        "\n&nbsp;&nbsp;&nbsp;&nbsp;",
-        '<font class="bold">\1</font>',
-        '<br />'
-      ), $source);
-    
-    $OUTPUT->command('set_headers', $source);
-    $OUTPUT->send();
+    if ($source !== false) {
+        $source = htmlspecialchars(trim($source));
+        $source = preg_replace(
+            array(
+                '/\n[\t\s]+/',
+                '/^([a-z0-9_:-]+)/im',
+                '/\r?\n/'
+            ),
+            array(
+                "\n&nbsp;&nbsp;&nbsp;&nbsp;",
+                '<font class="bold">\1</font>',
+                '<br />'
+            ), $source);
+
+        $OUTPUT->command('set_headers', $source);
     }
+    else {
+        $RCMAIL->output->show_message('messageopenerror', 'error');
+    }
+
+    $OUTPUT->send();
 }
-  
+
 exit;
 
 ?>

--
Gitblit v1.9.1