From 369e2a89996d93b50d41c7a8482963bd0e56962a Mon Sep 17 00:00:00 2001 From: uckelman Date: Wed, 17 Mar 2010 19:40:58 +0000 Subject: Reorganized. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6617 67b53d14-2c14-4ace-a08f-0dab2b34000c --- EMailMessage.php | 73 ---------------------------------------------------- Message.php | 21 --------------- src/EMailMessage.php | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Message.php | 21 +++++++++++++++ 4 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 EMailMessage.php delete mode 100644 Message.php create mode 100644 src/EMailMessage.php create mode 100644 src/Message.php diff --git a/EMailMessage.php b/EMailMessage.php deleted file mode 100644 index 9d921a9..0000000 --- a/EMailMessage.php +++ /dev/null @@ -1,73 +0,0 @@ -msg = MailMessage::decode_raw_message($input); - } - - public function getSource() { -# FIXME: fill in! - return null; - } - - public function getPostId() { -# FIXME: get from message-id to post-id database - return null; - } - - public function getFrom() { - return EMailMessage::parse_addr($this->msg->headers['from']); - } - - public function getSubject() { - return $this->msg->headers['subject']; - } - - public function getMessageId() { - return $this->msg->headers['message-id']; - } - - public function getInReplyTo() { - return $this->msg->headers['in-reply-to']; - } - - public function getReferences() { - return $this->msg->headers['references']; - } - - public function getBody() { - return $this->msg->body; - } - - protected static function decode_raw_message($input) { - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - $params['input'] = $input; - $params['crlf'] = "\r\n"; - - $msg = Mail_mimeDecode::decode($params); - - if (count($msg->headers) == 1 && array_key_exists(null, $msg->headers)) { - # An empty message has one null header. - trigger_error('No message', E_USER_ERROR); - } - - return $msg; - } - - protected static function parse_addr($s) { - $addr = Mail_RFC822::parseAddressList($s); - return strtolower($addr[0]->mailbox . '@' . $addr[0]->host); - } -} - -?> diff --git a/Message.php b/Message.php deleted file mode 100644 index 23fa849..0000000 --- a/Message.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/src/EMailMessage.php b/src/EMailMessage.php new file mode 100644 index 0000000..9d921a9 --- /dev/null +++ b/src/EMailMessage.php @@ -0,0 +1,73 @@ +msg = MailMessage::decode_raw_message($input); + } + + public function getSource() { +# FIXME: fill in! + return null; + } + + public function getPostId() { +# FIXME: get from message-id to post-id database + return null; + } + + public function getFrom() { + return EMailMessage::parse_addr($this->msg->headers['from']); + } + + public function getSubject() { + return $this->msg->headers['subject']; + } + + public function getMessageId() { + return $this->msg->headers['message-id']; + } + + public function getInReplyTo() { + return $this->msg->headers['in-reply-to']; + } + + public function getReferences() { + return $this->msg->headers['references']; + } + + public function getBody() { + return $this->msg->body; + } + + protected static function decode_raw_message($input) { + $params['include_bodies'] = true; + $params['decode_bodies'] = true; + $params['decode_headers'] = true; + $params['input'] = $input; + $params['crlf'] = "\r\n"; + + $msg = Mail_mimeDecode::decode($params); + + if (count($msg->headers) == 1 && array_key_exists(null, $msg->headers)) { + # An empty message has one null header. + trigger_error('No message', E_USER_ERROR); + } + + return $msg; + } + + protected static function parse_addr($s) { + $addr = Mail_RFC822::parseAddressList($s); + return strtolower($addr[0]->mailbox . '@' . $addr[0]->host); + } +} + +?> diff --git a/src/Message.php b/src/Message.php new file mode 100644 index 0000000..23fa849 --- /dev/null +++ b/src/Message.php @@ -0,0 +1,21 @@ + -- cgit v1.2.3