From ba6f21caeb405c7e8512a09941fefbc97286e45f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 21 Nov 2012 19:52:03 +0100 Subject: Framework files moved to lib/Roundcube --- program/include/rcube_message_header.php | 288 ------------------------------- 1 file changed, 288 deletions(-) delete mode 100644 program/include/rcube_message_header.php (limited to 'program/include/rcube_message_header.php') diff --git a/program/include/rcube_message_header.php b/program/include/rcube_message_header.php deleted file mode 100644 index db82247f9..000000000 --- a/program/include/rcube_message_header.php +++ /dev/null @@ -1,288 +0,0 @@ - | - +-----------------------------------------------------------------------+ -*/ - -/** - * Struct representing an e-mail message header - * - * @package Framework - * @subpackage Storage - * @author Aleksander Machniak - */ -class rcube_message_header -{ - /** - * Message sequence number - * - * @var int - */ - public $id; - - /** - * Message unique identifier - * - * @var int - */ - public $uid; - - /** - * Message subject - * - * @var string - */ - public $subject; - - /** - * Message sender (From) - * - * @var string - */ - public $from; - - /** - * Message recipient (To) - * - * @var string - */ - public $to; - - /** - * Message additional recipients (Cc) - * - * @var string - */ - public $cc; - - /** - * Message Reply-To header - * - * @var string - */ - public $replyto; - - /** - * Message In-Reply-To header - * - * @var string - */ - public $in_reply_to; - - /** - * Message date (Date) - * - * @var string - */ - public $date; - - /** - * Message identifier (Message-ID) - * - * @var string - */ - public $messageID; - - /** - * Message size - * - * @var int - */ - public $size; - - /** - * Message encoding - * - * @var string - */ - public $encoding; - - /** - * Message charset - * - * @var string - */ - public $charset; - - /** - * Message Content-type - * - * @var string - */ - public $ctype; - - /** - * Message timestamp (based on message date) - * - * @var int - */ - public $timestamp; - - /** - * IMAP bodystructure string - * - * @var string - */ - public $bodystructure; - - /** - * IMAP internal date - * - * @var string - */ - public $internaldate; - - /** - * Message References header - * - * @var string - */ - public $references; - - /** - * Message priority (X-Priority) - * - * @var int - */ - public $priority; - - /** - * Message receipt recipient - * - * @var string - */ - public $mdn_to; - - /** - * Other message headers - * - * @var array - */ - public $others = array(); - - /** - * Message flags - * - * @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, $decode = true) - { - $name = strtolower($name); - - if (isset($this->obj_headers[$name])) { - $value = $this->{$this->obj_headers[$name]}; - } - else { - $value = $this->others[$name]; - } - - return $decode ? rcube_mime::decode_header($value, $this->charset) : $value; - } - - /** - * 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; - } - } -} - - -/** - * Class for sorting an array of rcube_message_header objects in a predetermined order. - * - * @package Mail - * @author Aleksander Machniak - */ -class rcube_message_header_sorter -{ - private $uids = array(); - - - /** - * Set the predetermined sort order. - * - * @param array $index Numerically indexed array of IMAP UIDs - */ - function set_index($index) - { - $index = array_flip($index); - - $this->uids = $index; - } - - /** - * Sort the array of header objects - * - * @param array $headers Array of rcube_message_header objects indexed by UID - */ - function sort_headers(&$headers) - { - uksort($headers, array($this, "compare_uids")); - } - - /** - * Sort method called by uksort() - * - * @param int $a Array key (UID) - * @param int $b Array key (UID) - */ - function compare_uids($a, $b) - { - // then find each sequence number in my ordered list - $posa = isset($this->uids[$a]) ? intval($this->uids[$a]) : -1; - $posb = isset($this->uids[$b]) ? intval($this->uids[$b]) : -1; - - // return the relative position as the comparison value - return $posa - $posb; - } -} -- cgit v1.2.3