From 70eac89a5c17d665fa94156fd215e171906428b0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 25 Aug 2013 09:03:01 +0200 Subject: [PATCH] Fix so additional headers are added to all messages sent (#1489284) Conflicts: plugins/additional_message_headers/additional_message_headers.php program/lib/Roundcube/rcube.php --- CHANGELOG | 1 + .../additional_message_headers.php | 25 +++++++++++-------- .../additional_message_headers/package.xml | 7 +++--- program/include/rcmail.php | 4 +++ program/lib/Roundcube/rcube.php | 1 + program/steps/mail/sendmail.inc | 1 + 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cd847e6b0..acd543d19 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix so additional headers are added to all messages sent (#1489284) - Fix display issue after moving folder in Folder Manager (#1489293) - Fix handling of non-default date formats (#1489294) - Fix unquoted path in PREG expression on Windows (#1489290) diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php index 80c58d58b..43f9d0098 100644 --- a/plugins/additional_message_headers/additional_message_headers.php +++ b/plugins/additional_message_headers/additional_message_headers.php @@ -15,29 +15,32 @@ */ class additional_message_headers extends rcube_plugin { - public $task = 'mail'; - function init() { - $this->add_hook('message_outgoing_headers', array($this, 'message_headers')); + $this->add_hook('message_before_send', array($this, 'message_headers')); } function message_headers($args) { - $this->load_config(); + $this->load_config(); + + $headers = $args['message']->headers(); + $rcube = rcube::get_instance(); // additional email headers - $additional_headers = rcmail::get_instance()->config->get('additional_message_headers',array()); - foreach($additional_headers as $header=>$value){ + $additional_headers = $rcube->config->get('additional_message_headers', array()); + foreach ((array)$additional_headers as $header => $value) { if (null === $value) { - unset($args['headers'][$header]); - } else { - $args['headers'][$header] = $value; + unset($headers[$header]); + } + else { + $headers[$header] = $value; } } + $args['message']->_headers = array(); + $args['message']->headers($headers); + return $args; } } - -?> diff --git a/plugins/additional_message_headers/package.xml b/plugins/additional_message_headers/package.xml index 73c24fba7..c15d9f8b3 100644 --- a/plugins/additional_message_headers/package.xml +++ b/plugins/additional_message_headers/package.xml @@ -13,11 +13,10 @@ email@example.org yes - 2010-01-16 - + 2013-08-25 - 1.1.0 - 1.1.0 + 1.2.0 + 1.2.0 stable diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 675a2c057..4cfaca13c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -958,6 +958,10 @@ class rcmail extends rcube 'options' => $options, )); + if ($plugin['abort']) { + return isset($plugin['result']) ? $plugin['result'] : false; + } + $from = $plugin['from']; $mailto = $plugin['mailto']; $options = $plugin['options']; diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index af24b0e85..d5f1d59e9 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1295,6 +1295,7 @@ class rcube return $_SESSION['language']; } } + } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index cb3a40524..b1f5aebb0 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -462,6 +462,7 @@ if (!empty($CONFIG['useragent'])) { } // exec hook for header checking and manipulation +// Depracated: use message_before_send hook instead $data = $RCMAIL->plugins->exec_hook('message_outgoing_headers', array('headers' => $headers)); // sending aborted by plugin