summaryrefslogtreecommitdiff
path: root/roundcubemail/plugins/show_additional_headers/show_additional_headers.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-04-19 17:44:29 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-04-19 17:44:29 +0000
commitc4185d03cfb5c4e9df4c004b2c13a9b3c3196eac (patch)
tree4f7ca23360a62cf181bb23a0f2264d69481cac03 /roundcubemail/plugins/show_additional_headers/show_additional_headers.php
parent137ee56eda15ecccb6a619a906ac532fc5d6c042 (diff)
Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins)
git-svn-id: https://svn.roundcube.net/trunk@2401 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/plugins/show_additional_headers/show_additional_headers.php')
-rw-r--r--roundcubemail/plugins/show_additional_headers/show_additional_headers.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/roundcubemail/plugins/show_additional_headers/show_additional_headers.php b/roundcubemail/plugins/show_additional_headers/show_additional_headers.php
new file mode 100644
index 000000000..c31c9df6b
--- /dev/null
+++ b/roundcubemail/plugins/show_additional_headers/show_additional_headers.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * Show additional message headers
+ *
+ * Proof-of-concept plugin which will fetch additional headers
+ * and display them in the message view.
+ *
+ * Enable the plugin in config/main.inc.php and add your desired headers:
+ * $rcmail_config['show_additional_headers'] = array('User-Agent');
+ *
+ * @version 1.0
+ * @author Thomas Bruederli
+ * @website http://roundcube.net
+ */
+class show_additional_headers extends rcube_plugin
+{
+ public $task = 'mail';
+
+ function init()
+ {
+ $rcmail = rcmail::get_instance();
+ if ($rcmail->action == 'show' || $rcmail->action == 'preview') {
+ $this->add_hook('imap_init', array($this, 'imap_init'));
+ $this->add_hook('message_headers_output', array($this, 'message_headers'));
+ }
+ }
+
+ function imap_init($p)
+ {
+ $rcmail = rcmail::get_instance();
+ if ($add_headers = $rcmail->config->get('show_additional_headers', array()))
+ $p['fetch_headers'] = trim($p['fetch_headers'].' ' . strtoupper(join(' ', $add_headers)));
+
+ return $p;
+ }
+
+ function message_headers($p)
+ {
+ $rcmail = rcmail::get_instance();
+ foreach ($rcmail->config->get('show_additional_headers', array()) as $header) {
+ $key = strtolower($header);
+ if ($value = $p['headers']->others[$key])
+ $p['output'][$key] = array('title' => $header, 'value' => $value);
+ }
+
+ return $p;
+ }
+}