From 62a83b3bd5813885d964d9fd1509d52bb9c4f12c Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 12 Jan 2011 15:47:44 +0000 Subject: Copying plugins to release branch --- .../show_additional_headers.php | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 plugins/show_additional_headers/show_additional_headers.php (limited to 'plugins/show_additional_headers') diff --git a/plugins/show_additional_headers/show_additional_headers.php b/plugins/show_additional_headers/show_additional_headers.php new file mode 100644 index 000000000..1cbe690e9 --- /dev/null +++ b/plugins/show_additional_headers/show_additional_headers.php @@ -0,0 +1,52 @@ +action == 'show' || $rcmail->action == 'preview') { + $this->add_hook('imap_init', array($this, 'imap_init')); + $this->add_hook('message_headers_output', array($this, 'message_headers')); + } else if ($rcmail->action == '') { + // with enabled_caching we're fetching additional headers before show/preview + $this->add_hook('imap_init', array($this, 'imap_init')); + } + } + + function imap_init($p) + { + $rcmail = rcmail::get_instance(); + if ($add_headers = (array)$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 ((array)$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; + } +} -- cgit v1.2.3