From 0b6c1cf2b2f9530706bd7e4be2a2b08fa3754ce7 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 06 Sep 2008 14:04:15 -0400
Subject: [PATCH] Give the user a second chance when sending failes due session error

---
 program/steps/mail/sendmail.inc |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 9a79317..9efb0d7 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -21,12 +21,17 @@
 */
 
 
-if (!isset($_SESSION['compose']['id']))
-  {
+// remove all scripts and act as called in frame
+$OUTPUT->reset();
+$OUTPUT->framed = TRUE;
+
+
+if (!isset($_SESSION['compose']['id'])) {
   raise_error(array('code' => 500, 'file' => __FILE__, 'message' => "Invalid compose ID"), true, false);
-  rcmail_overwrite_action('compose');
-  return;
-  }
+  console("Sendmail error", $_SESSION['compose']);
+  $OUTPUT->show_message("An internal error occured. Please try again.", 'error');
+  $OUTPUT->send('iframe');
+}
 
 
 /****** message sending functions ********/
@@ -116,10 +121,6 @@
 
 $message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $RCMAIL->config->mail_domain($_SESSION['imap_host']));
 $savedraft = !empty($_POST['_draft']) ? TRUE : FALSE;
-
-// remove all scripts and act as called in frame
-$OUTPUT->reset();
-$OUTPUT->framed = TRUE;
 
 
 /****** check submission and compose message ********/

--
Gitblit v1.9.1