Save draft information in one header; finally fixes #1486203

release-0.6
thomascube 15 years ago
parent 56505a1174
commit bc404ffd41

@ -1451,7 +1451,7 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false, $bo
$request .= "(DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC ";
$request .= "CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID ";
$request .= "REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY ";
$request .= "X-REPLY-UID X-FORWARD-UID".$add.")])";
$request .= "X-DRAFT-INFO".$add.")])";
if (!iil_PutLine($fp, $request)) {
return false;

@ -156,13 +156,22 @@ if (!empty($msg_uid))
}
else if ($compose_mode == RCUBE_COMPOSE_DRAFT)
{
if($MESSAGE->headers->in_reply_to)
if ($MESSAGE->headers->others['x-draft-info'])
{
// get reply_uid/forward_uid to flag the original message when sending
$_SESSION['compose']['reply_uid'] = $MESSAGE->headers->others['x-reply-uid'];
$_SESSION['compose']['forward_uid'] = $MESSAGE->headers->others['x-forward-uid'];
$_SESSION['compose']['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>';
$info = rcmail_draftinfo_decode($MESSAGE->headers->others['x-draft-info']);
if ($info['type'] == 'reply')
$_SESSION['compose']['reply_uid'] = $info['uid'];
else if ($info['type'] == 'forward')
$_SESSION['compose']['forward_uid'] = $info['uid'];
$_SESSION['compose']['mailbox'] = $info['folder'];
}
if ($MESSAGE->headers->in_reply_to)
$_SESSION['compose']['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>';
$_SESSION['compose']['references'] = $MESSAGE->headers->references;
}
else if ($compose_mode == RCUBE_COMPOSE_FORWARD)

@ -1288,6 +1288,30 @@ function rcmail_wrap_quoted($text, $max = 76)
}
function rcmail_draftinfo_encode($p)
{
$parts = array();
foreach ($p as $key => $val)
$parts[] = $key . '=' . ($key == 'folder' ? base64_encode($val) : $val);
return join('; ', $parts);
}
function rcmail_draftinfo_decode($str)
{
$info = array();
foreach (preg_split('/;\s+/', $str) as $part) {
list($key, $val) = explode('=', $part, 2);
if ($key == 'folder')
$val = base64_decode($val);
$info[$key] = $val;
}
return $info;
}
function rcmail_message_part_controls()
{
global $MESSAGE;

@ -316,9 +316,9 @@ if (!empty($_SESSION['compose']['reply_msgid']))
// remember reply/forward UIDs in special headers
if (!empty($_SESSION['compose']['reply_uid']) && $savedraft)
$headers['X-Reply-UID'] = $_SESSION['compose']['reply_uid'];
$headers['X-Draft-Info'] = array('type' => 'reply', 'uid' => $_SESSION['compose']['reply_uid']);
else if (!empty($_SESSION['compose']['forward_uid']) && $savedraft)
$headers['X-Forward-UID'] = $_SESSION['compose']['forward_uid'];
$headers['X-Draft-Info'] = array('type' => 'forward', 'uid' => $_SESSION['compose']['forward_uid']);
if (!empty($_SESSION['compose']['references']))
$headers['References'] = $_SESSION['compose']['references'];
@ -341,6 +341,9 @@ if (!empty($_POST['_receipt']))
$headers['Message-ID'] = $message_id;
$headers['X-Sender'] = $from;
if (is_array($headers['X-Draft-Info']))
$headers['X-Draft-Info'] = rcmail_draftinfo_encode($headers['X-Draft-Info'] + array('folder' => $_SESSION['compose']['mailbox']));
if (!empty($CONFIG['useragent']))
$headers['User-Agent'] = $CONFIG['useragent'];

Loading…
Cancel
Save