Example #1
0
 /**
  * __construct
  *
  * Provide a uid, and parse message structure.
  *
  * @param string $uid The message UID.
  *
  * @see self::$app, self::$storage, self::$opt, self::$parts
  */
 function __construct($uid)
 {
     $this->uid = $uid;
     $this->app = rcmail::get_instance();
     $this->storage = $this->app->get_storage();
     $this->storage->set_options(array('all_headers' => true));
     $this->headers = $this->storage->get_message($uid);
     if (!$this->headers) {
         return;
     }
     $this->mime = new rcube_mime($this->headers->charset);
     $this->subject = $this->mime->decode_mime_string($this->headers->subject);
     list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
     $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->storage->get_folder(), '_uid' => $uid)));
     if (!empty($this->headers->structure)) {
         $this->get_mime_numbers($this->headers->structure);
         $this->parse_structure($this->headers->structure);
     } else {
         $this->body = $this->storage->get_body($uid);
     }
     // notify plugins and let them analyze this structured message object
     $this->app->plugins->exec_hook('message_load', array('object' => $this));
 }