summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-08-25 09:03:01 +0200
committerAleksander Machniak <alec@alec.pl>2013-08-25 09:03:01 +0200
commit6efadfc8d38730f3ee6d0bbcd53bdc24ef094116 (patch)
tree90c47cd6bf66152001d6f66e741c902f5f8c5ccd
parent1305079d75413743c3954ae0c3a1757b38676782 (diff)
Fix so additional headers are added to all messages sent (#1489284)
-rw-r--r--CHANGELOG1
-rw-r--r--plugins/additional_message_headers/additional_message_headers.php23
-rw-r--r--plugins/additional_message_headers/package.xml7
-rw-r--r--program/lib/Roundcube/rcube.php4
-rw-r--r--program/steps/mail/sendmail.inc1
5 files changed, 23 insertions, 13 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 74021ba4e..36276478c 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 c54f77d2d..0d16e605e 100644
--- a/plugins/additional_message_headers/additional_message_headers.php
+++ b/plugins/additional_message_headers/additional_message_headers.php
@@ -15,27 +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>email@example.org</email>
<active>yes</active>
</lead>
- <date>2010-01-16</date>
- <time>18:19:33</time>
+ <date>2013-08-25</date>
<version>
- <release>1.1.0</release>
- <api>1.1.0</api>
+ <release>1.2.0</release>
+ <api>1.2.0</api>
</version>
<stability>
<release>stable</release>
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index fbf9540ad..af9c069cf 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1397,6 +1397,10 @@ class 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/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index cf22a2af9..1a92844c0 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -455,6 +455,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