From ceb2a31b3857925e749047e2c4c574a38bf8e9ed Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sun, 10 Nov 2013 12:50:17 -0500
Subject: [PATCH] Compare draft message-ID when restoring local message contents

---
 program/steps/mail/compose.inc |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 646d2bc..8d275f9 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -110,9 +110,10 @@
     'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', 
     'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany',
     'fileuploaderror', 'sendmessage', 'savenewresponse', 'responsename', 'responsetext', 'save',
-    'savingresponse');
+    'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore');
 
 $OUTPUT->set_env('compose_id', $COMPOSE['id']);
+$OUTPUT->set_env('session_id', session_id());
 $OUTPUT->set_pagetitle(rcube_label('compose'));
 
 // add config parameters to client script
@@ -239,6 +240,9 @@
       $COMPOSE['reply_msgid'] = '<' . $in_reply_to . '>';
 
     $COMPOSE['references'] = $MESSAGE->headers->references;
+
+    // use message-ID as draft_id, same as in sendmail.inc
+    $OUTPUT->set_env('draft_id', trim($MESSAGE->headers->get('message-id'), '<>'));
   }
 }
 else {
@@ -827,6 +831,9 @@
   $msgtype = new html_hiddenfield(array('name' => '_is_html', 'value' => ($isHtml?"1":"0")));
   $out .= $msgtype->show();
 
+  $framed = new html_hiddenfield(array('name' => '_framed', 'value' => '1'));
+  $out .= $framed->show();
+
   // If desired, set this textarea to be editable by TinyMCE
   if ($isHtml) {
     $MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCMAIL_CHARSET);

--
Gitblit v1.9.1