summaryrefslogtreecommitdiff
path: root/src/EMailMessage.php
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-03-20 13:46:11 +0000
committeruckelman <uckelman@nomic.net>2010-03-20 13:46:11 +0000
commit8cba263bbcc182839695c068abf145195a07bffc (patch)
tree7e86138e2e351c7a094ea7322076ea4b6baef977 /src/EMailMessage.php
parent13a0097cc17f93ef3ee2a984e807bdead5c6987e (diff)
Completed tests for most EmailMessage methods.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6619 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src/EMailMessage.php')
-rw-r--r--src/EMailMessage.php73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/EMailMessage.php b/src/EMailMessage.php
deleted file mode 100644
index 9d921a9..0000000
--- a/src/EMailMessage.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-require_once('Mail/mimeDecode.php');
-require_once('Mail/RFC822.php');
-
-require_once('Message.php');
-
-class EMailMessage implements Message {
-
- protected $msg;
-
- public function __construct($input) {
- $this->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);
- }
-}
-
-?>