| | |
| | | { |
| | | $this->uid = $uid; |
| | | $this->app = rcmail::get_instance(); |
| | | $this->imap = $this->app->imap; |
| | | $this->imap->get_all_headers = true; |
| | | $this->storage = $this->app->get_storage(); |
| | | $this->storage->set_options(array('all_headers' => true)); |
| | | |
| | | $this->headers = $this->imap->get_message($uid); |
| | | $this->headers = $this->storage->get_message($uid); |
| | | |
| | | if (!$this->headers) |
| | | return; |
| | |
| | | 'safe' => $this->is_safe, |
| | | 'prefer_html' => $this->app->config->get('prefer_html'), |
| | | 'get_url' => rcmail_url('get', array( |
| | | '_mbox' => $this->imap->get_mailbox_name(), '_uid' => $uid)) |
| | | '_mbox' => $this->storage->get_folder(), '_uid' => $uid)) |
| | | ); |
| | | |
| | | if (!empty($this->headers->structure)) { |
| | |
| | | $this->parse_structure($this->headers->structure); |
| | | } |
| | | else { |
| | | $this->body = $this->imap->get_body($uid); |
| | | $this->body = $this->storage->get_body($uid); |
| | | } |
| | | |
| | | // notify plugins and let them analyze this structured message object |
| | |
| | | return $fp ? true : $part->body; |
| | | } |
| | | // get from IMAP |
| | | return $this->imap->get_message_part($this->uid, $mime_id, $part, NULL, $fp); |
| | | return $this->storage->get_message_part($this->uid, $mime_id, $part, NULL, $fp); |
| | | } else |
| | | return null; |
| | | } |
| | |
| | | foreach ($this->mime_parts as $mime_id => $part) { |
| | | $mimetype = strtolower($part->ctype_primary . '/' . $part->ctype_secondary); |
| | | if ($mimetype == 'text/html') { |
| | | return $this->imap->get_message_part($this->uid, $mime_id, $part); |
| | | return $this->storage->get_message_part($this->uid, $mime_id, $part); |
| | | } |
| | | } |
| | | } |
| | |
| | | $mimetype = $part->ctype_primary . '/' . $part->ctype_secondary; |
| | | |
| | | if ($mimetype == 'text/plain') { |
| | | return $this->imap->get_message_part($this->uid, $mime_id, $part); |
| | | return $this->storage->get_message_part($this->uid, $mime_id, $part); |
| | | } |
| | | else if ($mimetype == 'text/html') { |
| | | $out = $this->imap->get_message_part($this->uid, $mime_id, $part); |
| | | $out = $this->storage->get_message_part($this->uid, $mime_id, $part); |
| | | |
| | | // remove special chars encoding |
| | | $trans = array_flip(get_html_translation_table(HTML_ENTITIES)); |
| | |
| | | { |
| | | // @TODO: attachment may be huge, hadle it via file |
| | | if (!isset($part->body)) |
| | | $part->body = $this->imap->get_message_part($this->uid, $part->mime_id, $part); |
| | | $part->body = $this->storage->get_message_part($this->uid, $part->mime_id, $part); |
| | | |
| | | $parts = array(); |
| | | $tnef = new tnef_decoder; |
| | |
| | | { |
| | | // @TODO: messages may be huge, hadle body via file |
| | | if (!isset($part->body)) |
| | | $part->body = $this->imap->get_message_part($this->uid, $part->mime_id, $part); |
| | | $part->body = $this->storage->get_message_part($this->uid, $part->mime_id, $part); |
| | | |
| | | $parts = array(); |
| | | // FIXME: line length is max.65? |