/** * __construct * * Provide a uid, and parse message structure. * * @param string $uid The message UID. * * @uses rcmail::get_instance() * @uses rcube_imap::decode_mime_string() * @uses self::set_safe() * * @see self::$app, self::$imap, self::$opt, self::$structure */ function __construct($uid) { $this->app = rcmail::get_instance(); $this->imap = $this->app->imap; $this->imap->get_all_headers = true; $this->uid = $uid; $this->headers = $this->imap->get_headers($uid, NULL, true, true); if (!$this->headers) { return; } $this->subject = rcube_imap::decode_mime_string($this->headers->subject, $this->headers->charset); list(, $this->sender) = each($this->imap->decode_address_list($this->headers->from)); $this->set_safe(intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid]); $this->opt = array('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))); if ($this->structure = $this->imap->get_structure($uid, $this->headers->body_structure)) { $this->get_mime_numbers($this->structure); $this->parse_structure($this->structure); } else { $this->body = $this->imap->get_body($uid); } // notify plugins and let them analyze this structured message object $this->app->plugins->exec_hook('message_load', array('object' => $this)); }