From 2965a981b7ec22866fbdf2d567d87e2d068d3617 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 31 Jul 2015 16:04:08 -0400
Subject: [PATCH] Allow to search and import missing PGP pubkeys from keyservers using Publickey.js

---
 plugins/additional_message_headers/additional_message_headers.php |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php
new file mode 100644
index 0000000..0d16e60
--- /dev/null
+++ b/plugins/additional_message_headers/additional_message_headers.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Additional Message Headers
+ *
+ * Very simple plugin which will add additional headers
+ * to or remove them from outgoing messages.
+ *
+ * Enable the plugin in config.inc.php and add your desired headers:
+ * $config['additional_message_headers'] = array('User-Agent' => 'My-Very-Own-Webmail');
+ *
+ * @version @package_version@
+ * @author Ziba Scott
+ * @website http://roundcube.net
+ */
+class additional_message_headers extends rcube_plugin
+{
+    function init()
+    {
+        $this->add_hook('message_before_send', array($this, 'message_headers'));
+    }
+
+    function message_headers($args)
+    {
+        $this->load_config();
+
+        $headers = $args['message']->headers();
+        $rcube   = rcube::get_instance();
+
+        // additional email headers
+        $additional_headers = $rcube->config->get('additional_message_headers', array());
+        foreach ((array)$additional_headers as $header => $value) {
+            if (null === $value) {
+                unset($headers[$header]);
+            }
+            else {
+                $headers[$header] = $value;
+            }
+        }
+
+        $args['message']->_headers = array();
+        $args['message']->headers($headers);
+
+        return $args;
+    }
+}

--
Gitblit v1.9.1