diff options
author | alecpl <alec@alec.pl> | 2012-04-23 07:13:29 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2012-04-23 07:13:29 +0000 |
commit | 111f5098d532b4eba47f2a496ed02d2203077690 (patch) | |
tree | 7d5f5c6a60588212324f35735d0619807cdad143 /program | |
parent | 390959bb323679f7611ee1585d8e1f55007c7773 (diff) |
- Implement set/get helper methods in rcube_message_header class
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_message_header.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/program/include/rcube_message_header.php b/program/include/rcube_message_header.php index ee7e1e34b..ad6bc5e52 100644 --- a/program/include/rcube_message_header.php +++ b/program/include/rcube_message_header.php @@ -184,6 +184,55 @@ class rcube_message_header * @var array */ public $flags = array(); + + // map header to rcube_message_header object property + private $obj_headers = array( + 'date' => 'date', + 'from' => 'from', + 'to' => 'to', + 'subject' => 'subject', + 'reply-to' => 'replyto', + 'cc' => 'cc', + 'bcc' => 'bcc', + 'content-transfer-encoding' => 'encoding', + 'in-reply-to' => 'in_reply_to', + 'content-type' => 'ctype', + 'references' => 'references', + 'return-receipt-to' => 'mdn_to', + 'disposition-notification-to' => 'mdn_to', + 'x-confirm-reading-to' => 'mdn_to', + 'message-id' => 'messageID', + 'x-priority' => 'priority', + ); + + /** + * Returns header value + */ + public function get($name) + { + $name = strtolower($name); + + if (isset($this->obj_headers[$name])) { + return $this->{$this->obj_headers[$name]}; + } + + return $this->others[$name]; + } + + /** + * Sets header value + */ + public function set($name, $value) + { + $name = strtolower($name); + + if (isset($this->obj_headers[$name])) { + $this->{$this->obj_headers[$name]} = $value; + } + else { + $this->others[$name] = $value; + } + } } |