diff options
author | uckelman <uckelman@nomic.net> | 2010-04-13 21:04:54 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-04-13 21:04:54 +0000 |
commit | ff6734201fb07bca69eb90ffadc310ab279479be (patch) | |
tree | fa088009b7d9e94d9945ad7dc477d05354950714 | |
parent | 34d2ec8c971abe0cea9b7e594eeb30779505c6e1 (diff) |
More code.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6704 67b53d14-2c14-4ace-a08f-0dab2b34000c
-rw-r--r-- | src/F2M.php | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/F2M.php b/src/F2M.php index 8ed83c2..086a4cd 100644 --- a/src/F2M.php +++ b/src/F2M.php @@ -17,7 +17,8 @@ function send_to_lists($user, $data, $post_data) { $postId = $data['post_id']; $forumId = $data['forum_id']; - + $topidId = $data['topic_id']; + $bridge = new Bridge(); $to = $bridge->getLists($forumId); @@ -44,19 +45,22 @@ function send_to_lists($user, $data, $post_data) { $date = date(DATE_RFC2822, $time); $messageId = build_message_id($time, $postId, $_SERVER['SERVER_NAME']); + $inReplyTo = null; + $references = null; + $forumURL = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']); $body = $data['message']; -/* + print '<p>'; var_dump($data); var_dump($post_data); print '</p>'; -*/ - # assemble the message headers +/* + # Assemble the message headers $headers = array( 'To' => $to, 'From' => $from, @@ -66,12 +70,35 @@ function send_to_lists($user, $data, $post_data) { 'X-BeenThere' => $forumURL, ); - # send the message + if ($inReplyTo !== null) { + $headers['In-Reply-To'] = $inReplyTo; + } + + if ($references !== null) { + $headers['References'] = $references; + } + $mailer = Mail::factory('sendmail'); - $err = $mailer->send($to, $headers, $body); - if (PEAR::isError($err)) { - throw new Exception('Mail::send error: ' . $err->toString()); + + $seen = !$bridge->registerMessage($postId, $messageId, + $inReplyTo, $references); + if ($seen) { + throw new Exception('message id already seen: ' . $messageId); } + + try { + # Send the message + $err = $mailer->send($to, $headers, $body); + if (PEAR::isError($err)) { + throw new Exception('Mail::send error: ' . $err->toString()); + } + } + catch (Exception $e) { + # Bridging failed, unregister message. + $bridge->unregisterMessage($messageId); + throw $e; + } +*/ } ?> |