From cc97ea0559af1a92a54dbcdf738ee4d95e67d3ff Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 19 Apr 2009 17:44:29 +0000 Subject: Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins) --- .../show_additional_headers.php | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 plugins/show_additional_headers/show_additional_headers.php (limited to 'plugins/show_additional_headers/show_additional_headers.php') 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..c31c9df6b --- /dev/null +++ b/plugins/show_additional_headers/show_additional_headers.php @@ -0,0 +1,49 @@ +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; + } +} -- cgit v1.2.3