From 5de338e45ebca0d055e0bb2a8df4db20fa61c6de Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 17 Oct 2015 07:38:36 -0400
Subject: [PATCH] Update changelog
---
program/steps/mail/compose.inc | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index ba6f334..c888028 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -47,9 +47,11 @@
if (!is_array($COMPOSE)) {
// Infinite redirect prevention in case of broken session (#1487028)
if ($COMPOSE_ID) {
- rcube::raise_error(array('code' => 500, 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Invalid compose ID"), true, true);
+ // if we know the message with specified ID was already sent
+ // we can ignore the error and compose a new message (#1490009)
+ if ($COMPOSE_ID != $_SESSION['last_compose_session']) {
+ rcube::raise_error(array('code' => 450), false, true);
+ }
}
$COMPOSE_ID = uniqid(mt_rand());
@@ -91,6 +93,7 @@
$OUTPUT->set_env('session_id', session_id());
$OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder());
$OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0);
+$OUTPUT->set_env('sig_below', $RCMAIL->config->get('sig_below'));
$OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ',')));
$OUTPUT->set_env('save_localstorage', (bool)$RCMAIL->config->get('compose_save_localstorage'));
$OUTPUT->set_env('is_sent', false);
@@ -331,12 +334,17 @@
else if (!empty($MESSAGE->headers->from))
$fvalue = $MESSAGE->headers->from;
- // Reply to message sent by yourself (#1487074, #1489230)
+ // Reply to message sent by yourself (#1487074, #1489230, #1490439)
// Reply-To address need to be unset (#1490233)
- if (!empty($ident) && empty($replyto)
- && in_array($ident['ident'], array($fvalue, $MESSAGE->headers->from))
- ) {
- $fvalue = $MESSAGE->headers->to;
+ if (!empty($ident) && empty($replyto)) {
+ foreach (array($fvalue, $MESSAGE->headers->from) as $sender) {
+ $senders = rcube_mime::decode_address_list($sender, null, false, $charset, true);
+
+ if (in_array($ident['email_ascii'], $senders)) {
+ $fvalue = $MESSAGE->headers->to;
+ break;
+ }
+ }
}
}
// add recipient of original message if reply to all
@@ -346,8 +354,12 @@
if ($v = $MESSAGE->headers->cc)
$fvalue .= (!empty($fvalue) ? $separator : '') . $v;
// Use Sender header (#1489011)
- if (($v = $MESSAGE->headers->get('Sender', false)) && strpos($v, '-bounces@') === false)
- $fvalue .= (!empty($fvalue) ? $separator : '') . $v;
+ if ($v = $MESSAGE->headers->get('Sender', false)) {
+ // Skip common mailing lists addresses: *-bounces@ and *-request@ (#1490452)
+ if (empty($MESSAGE->headers->others['list-post']) || !preg_match('/-(bounces|request)@/', $v)) {
+ $fvalue .= (!empty($fvalue) ? $separator : '') . $v;
+ }
+ }
// When To: and Reply-To: are the same we add From: address to the list (#1489037)
if ($v = $MESSAGE->headers->from) {
@@ -449,7 +461,8 @@
// #1486037: remove "mailto:" prefix
$COMPOSE['param']['to'] = preg_replace('/^mailto:/i', '', $mailto[0]);
// #1490346: decode the recipient address
- $COMPOSE['param']['to'] = urldecode($COMPOSE['param']['to']);
+ // #1490510: use raw encoding for correct "+" character handling as specified in RFC6068
+ $COMPOSE['param']['to'] = rawurldecode($COMPOSE['param']['to']);
// Supported case-insensitive tokens in mailto URL
$url_tokens = array('to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'body');
@@ -612,8 +625,10 @@
if (count($MESSAGE->identities)) {
$a_signatures = array();
$identities = array();
- $separator = intval($RCMAIL->config->get('reply_mode')) > 0
- && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD) ? '---' : '-- ';
+ $top_posting = intval($RCMAIL->config->get('reply_mode')) > 0
+ && !$RCMAIL->config->get('sig_below')
+ && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD);
+ $separator = $top_posting ? '---' : '-- ';
$field_attrib['onchange'] = rcmail_output::JS_OBJECT_NAME.".change_identity(this)";
$select_from = new html_select($field_attrib);
@@ -669,7 +684,6 @@
return $out;
}
-
function rcmail_compose_editor_mode()
{
--
Gitblit v1.9.1