Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2022-04-10 12:32:40 +0300
committerAleksander Machniak <alec@alec.pl>2022-04-10 12:34:40 +0300
commit1b4f3644301e419ef8cf74e9a3ff501b1699af87 (patch)
tree6c2822874f65286b0675ee1ef164a2bcd3c25e11
parentc3da7b9f450780708100d0e979c692238fd5a2f4 (diff)
Fix bug where DSN flag state wasn't stored with a draft (#8371)
-rw-r--r--CHANGELOG.md1
-rw-r--r--program/actions/mail/compose.php19
-rw-r--r--program/include/rcmail_sendmail.php31
3 files changed, 34 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 503960da0..f4d5d6b01 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
- Fix bug where attachment icons were stuck at the top of the messages list in Safari (#8433)
- Fix handling of message/rfc822 parts that are small and are multipart structures with a single part (#8458)
- Fix bug where session could time out if DB and PHP timezone were different (#8303)
+- Fix bug where DSN flag state wasn't stored with a draft (#8371)
## Release 1.5.2
diff --git a/program/actions/mail/compose.php b/program/actions/mail/compose.php
index 316efb567..33c1f7f93 100644
--- a/program/actions/mail/compose.php
+++ b/program/actions/mail/compose.php
@@ -141,6 +141,7 @@ class rcmail_action_mail_compose extends rcmail_action_mail_index
$compose_mode = null;
$msg_uid = null;
+ $options = [];
// get reference message and set compose mode
if (!empty(self::$COMPOSE['param']['draft_uid'])) {
@@ -255,11 +256,17 @@ class rcmail_action_mail_compose extends rcmail_action_mail_index
// get reply_uid/forward_uid to flag the original message when sending
$info = rcmail_sendmail::draftinfo_decode($draft_info);
- if ($info['type'] == 'reply') {
- self::$COMPOSE['reply_uid'] = $info['uid'];
+ if (!empty($info['type'])) {
+ if ($info['type'] == 'reply') {
+ self::$COMPOSE['reply_uid'] = $info['uid'];
+ }
+ else if ($info['type'] == 'forward') {
+ self::$COMPOSE['forward_uid'] = $info['uid'];
+ }
}
- else if ($info['type'] == 'forward') {
- self::$COMPOSE['forward_uid'] = $info['uid'];
+
+ if (!empty($info['dsn']) && $info['dsn'] === 'on') {
+ $options['dsn_enabled'] = true;
}
self::$COMPOSE['mailbox'] = $info['folder'];
@@ -306,8 +313,10 @@ class rcmail_action_mail_compose extends rcmail_action_mail_index
$rcmail->output->set_env('reply_msgid', self::$COMPOSE['reply_msgid']);
}
+ $options['message'] = self::$MESSAGE;
+
// Initialize helper class to build the UI
- self::$SENDMAIL = new rcmail_sendmail(self::$COMPOSE, ['message' => self::$MESSAGE]);
+ self::$SENDMAIL = new rcmail_sendmail(self::$COMPOSE, $options);
// process self::$MESSAGE body/attachments, set self::$MESSAGE_BODY/$HTML_MODE vars and some session data
self::$MESSAGE_BODY = self::prepare_message_body();
diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php
index 145565e64..5be29ab69 100644
--- a/program/include/rcmail_sendmail.php
+++ b/program/include/rcmail_sendmail.php
@@ -52,6 +52,7 @@ class rcmail_sendmail
* saveonly (bool) - Enable save-only mode
* message (object) - Message object to get some data from
* error_handler (callback) - Error handler
+ * dsn_enabled (bool) - Enable DSN
*/
public function __construct($data = [], $options = [])
{
@@ -222,28 +223,34 @@ class rcmail_sendmail
// remember reply/forward UIDs in special headers
if (!empty($this->options['savedraft'])) {
+ $draft_info = [];
+
// Note: We ignore <UID>.<PART> forwards/replies here
if (
!empty($this->data['reply_uid'])
&& ($uid = $this->data['reply_uid'])
&& !preg_match('/^\d+\.[0-9.]+$/', $uid)
) {
- $headers['X-Draft-Info'] = $this->draftinfo_encode([
- 'type' => 'reply',
- 'uid' => $uid,
- 'folder' => $this->data['mailbox']
- ]);
+ $draft_info['type'] = 'reply';
+ $draft_info['uid'] = $uid;
+ $draft_info['folder'] = $this->data['mailbox'];
}
else if (
!empty($this->data['forward_uid'])
&& ($uid = rcube_imap_generic::compressMessageSet($this->data['forward_uid']))
&& !preg_match('/^\d+[0-9.]+$/', $uid)
) {
- $headers['X-Draft-Info'] = $this->draftinfo_encode([
- 'type' => 'forward',
- 'uid' => $uid,
- 'folder' => $this->data['mailbox']
- ]);
+ $draft_info['type'] = 'forward';
+ $draft_info['uid'] = $uid;
+ $draft_info['folder'] = $this->data['mailbox'];
+ }
+
+ if ($dsn_enabled) {
+ $draft_info['dsn'] = 'on';
+ }
+
+ if (!empty($draft_info)) {
+ $headers['X-Draft-Info'] = $this->draftinfo_encode($draft_info);
}
}
@@ -1390,8 +1397,8 @@ class rcmail_sendmail
$checkbox = new html_checkbox($attrib);
- if (isset($_POST['_dsn'])) {
- $dsn_value = (int) $_POST['_dsn'];
+ if (!empty($_POST['_dsn']) || !empty($this->options['dsn_enabled'])) {
+ $dsn_value = 1;
}
else {
$dsn_value = $this->rcmail->config->get('dsn_default');