diff options
author | uckelman <uckelman@nomic.net> | 2010-04-11 15:26:56 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-04-11 15:26:56 +0000 |
commit | 66be33480a0b891106ab3e8a75420843f36f6665 (patch) | |
tree | e841ae8fad9a222317d9a3072b816fd7f9c164df /src | |
parent | 5a3cbc6324cf6e3185adf056cf6fd982969eb4fc (diff) |
Added more code.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6654 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r-- | src/M2F.php | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/M2F.php b/src/M2F.php index 7dd56b0..fd2901f 100644 --- a/src/M2F.php +++ b/src/M2F.php @@ -3,7 +3,7 @@ require_once(__DIR__ . '/Bridge.php'); require_once(__DIR__ . '/MailmanLib.php'); require_once(__DIR__ . '/MailmanMessage.php'); -require_once(__DIR__ . '/PhpBB3Lib.php'); +require_once(__DIR__ . '/PhpBB3.php'); # Read the message from STDIN $url = 'php://stdin'; @@ -11,24 +11,41 @@ $url = 'php://stdin'; $input = read_raw_message($url); $msg = new MailmanMessage($input); -$user = get_user_id($msg->getFrom()); -$userName = get_user_name($userId); - $bridge = new Bridge(); +$seen = $bridge->registerMessage($msg->getMessageId(), + $msg->getInReplyTo(), + $msg->getReferences()); + +if ($seen) { + # This message has already been processed. + exit; +} + +$phpbb = new PhpBB3(); + $inReplyTo = $msg->getInReplyTo(); +$forumId = $topicId = -1; +$postType = null; + if ($inReplyTo) { - # Is this a reply? + # A reply to an existing topic # FIXME: we don't want exceptions here? $parentId = $bridge->getPostId($inReplyTo); - $topicId = get_topic_id($parentId); + $ids = $phpbb->getTopicAndForumIds($parentId); + $forumId = $ids['forum_id']; + $topicId = $ids['topic_id']; + $postType = 'reply'; } else { - # a new message - + # A message starting a new topic + $forumId = $bridge->getDefaultForumId($msg->getSource()); + $postType = 'post'; } -#$forumId = get_default_forum_id($msg->getSource()); +# Post the message to the forum +$phpbb->postMessage($postType, $forumId, $topicId, $msg); +$bridge->setPostId($messageId, $postId); ?> |