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 .= "(DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC ";
$request .= "CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID "; $request .= "CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID ";
$request .= "REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY "; $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)) { if (!iil_PutLine($fp, $request)) {
return false; return false;

@ -151,18 +151,27 @@ if (!empty($msg_uid))
if (!empty($_SESSION['compose']['param']['all'])) if (!empty($_SESSION['compose']['param']['all']))
$MESSAGE->reply_all = 1; $MESSAGE->reply_all = 1;
$OUTPUT->set_env('compose_mode', 'reply'); $OUTPUT->set_env('compose_mode', 'reply');
} }
else if ($compose_mode == RCUBE_COMPOSE_DRAFT) 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 // get reply_uid/forward_uid to flag the original message when sending
$_SESSION['compose']['reply_uid'] = $MESSAGE->headers->others['x-reply-uid']; $info = rcmail_draftinfo_decode($MESSAGE->headers->others['x-draft-info']);
$_SESSION['compose']['forward_uid'] = $MESSAGE->headers->others['x-forward-uid'];
$_SESSION['compose']['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>'; 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; $_SESSION['compose']['references'] = $MESSAGE->headers->references;
} }
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) 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() function rcmail_message_part_controls()
{ {
global $MESSAGE; global $MESSAGE;

@ -313,12 +313,12 @@ else if (!empty($identity_arr['reply-to']))
if (!empty($_SESSION['compose']['reply_msgid'])) if (!empty($_SESSION['compose']['reply_msgid']))
$headers['In-Reply-To'] = $_SESSION['compose']['reply_msgid']; $headers['In-Reply-To'] = $_SESSION['compose']['reply_msgid'];
// remember reply/forward UIDs in special headers // remember reply/forward UIDs in special headers
if (!empty($_SESSION['compose']['reply_uid']) && $savedraft) 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) 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'])) if (!empty($_SESSION['compose']['references']))
$headers['References'] = $_SESSION['compose']['references']; $headers['References'] = $_SESSION['compose']['references'];
@ -341,6 +341,9 @@ if (!empty($_POST['_receipt']))
$headers['Message-ID'] = $message_id; $headers['Message-ID'] = $message_id;
$headers['X-Sender'] = $from; $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'])) if (!empty($CONFIG['useragent']))
$headers['User-Agent'] = $CONFIG['useragent']; $headers['User-Agent'] = $CONFIG['useragent'];

Loading…
Cancel
Save