registerMessage($msg->getMessageId(), $msg->getInReplyTo(), $msg->getReferences()); if ($seen) { # This message has already been processed. print 'Message id already seen, skipping: ' . $msg->getMessageId() . "\n"; exit; } $phpbb = new PhpBB3(); $inReplyTo = $msg->getInReplyTo(); $forumId = $topicId = -1; $postType = null; if ($inReplyTo) { # A reply to an existing topic # FIXME: we don't want exceptions here? $parentId = $bridge->getPostId($inReplyTo); $ids = $phpbb->getTopicAndForumIds($parentId); $forumId = $ids['forum_id']; $topicId = $ids['topic_id']; $postType = 'reply'; } else { # A message starting a new topic $forumId = $bridge->getDefaultForumId($msg->getSource()); $postType = 'post'; } # Post the message to the forum $phpbb->postMessage($postType, $forumId, $topicId, $msg); $bridge->setPostId($messageId, $postId); ?>