diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-12-10 22:26:45 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-12-10 22:26:45 +0100 |
commit | a8a72e2e7ee89caa04f8f13b6067e1b4ad870612 (patch) | |
tree | 1a768a725122e4020536f4518db536a4146c3ddc /program/lib | |
parent | 1aaa4bc3937187c54039a8459409a2efd9cb3cd7 (diff) |
Nicely render headers of message/rfc822 parts
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/Roundcube/rcube_message.php | 9 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_message_header.php | 16 |
2 files changed, 24 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php index 4ef534a0a..c626af08a 100644 --- a/program/lib/Roundcube/rcube_message.php +++ b/program/lib/Roundcube/rcube_message.php @@ -320,8 +320,15 @@ class rcube_message private function parse_structure($structure, $recursive = false) { // real content-type of message/rfc822 part - if ($structure->mimetype == 'message/rfc822' && $structure->real_mimetype) + if ($structure->mimetype == 'message/rfc822' && $structure->real_mimetype) { $mimetype = $structure->real_mimetype; + + // parse headers from message/rfc822 part + if (!isset($structure->headers['subject'])) { + list($headers, $dump) = explode("\r\n\r\n", $this->get_part_content($structure->mime_id, null, true, 4096)); + $structure->headers = rcube_mime::parse_headers($headers); + } + } else $mimetype = $structure->mimetype; diff --git a/program/lib/Roundcube/rcube_message_header.php b/program/lib/Roundcube/rcube_message_header.php index 445d0bd39..7009a00af 100644 --- a/program/lib/Roundcube/rcube_message_header.php +++ b/program/lib/Roundcube/rcube_message_header.php @@ -235,6 +235,22 @@ class rcube_message_header $this->others[$name] = $value; } } + + + /** + * Factory method to instantiate headers from a data array + * + * @param array Hash array with header values + * @return object rcube_message_header instance filled with headers values + */ + public static function from_array($arr) + { + $obj = new rcube_message_header; + foreach ($arr as $k => $v) + $obj->set($k, $v); + + return $obj; + } } |