From e3f6bc31ff1e108de52faae926d96a73df32557e Mon Sep 17 00:00:00 2001 From: uckelman Date: Fri, 30 Apr 2010 21:38:50 +0000 Subject: mv M2F.php list_post_receive.php. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6797 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/M2F.php | 78 --------------------------------------------- src/list_post_receive.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 78 deletions(-) delete mode 100644 src/M2F.php create mode 100644 src/list_post_receive.php diff --git a/src/M2F.php b/src/M2F.php deleted file mode 100644 index a8d2749..0000000 --- a/src/M2F.php +++ /dev/null @@ -1,78 +0,0 @@ -getMessageId(); - $inReplyTo = $msg->getInReplyTo(); - $rererences = $msg->getReferences(); - - $bridge = new Bridge(); - $seen = !$bridge->registerMessage(null, $messageId, $inReplyTo); - - try { - if ($seen) { - # This message has already been processed, bail out - print 'Message id already seen, skipping: ' . $messageId . "\n"; - exit; - } - - $phpbb = new PhpBB3(); - - $forumId = $topicId = -1; - $postType = null; - - if ($inReplyTo) { - # Possibly a reply to an existing topic - $parentId = $bridge->getPostId($inReplyTo); - if ($parentId === false) { - throw new Exception('unrecognized reply-to: ' . $inReplyTo); - } - - $ids = $phpbb->getTopicAndForumIds($parentId); - if ($ids === false) { - throw new Exception('unrecognized parent id: ' . $parentId); - } - - # Found the parent's forum and topic, post to those - $forumId = $ids['forum_id']; - $topicId = $ids['topic_id']; - $postType = 'reply'; - } - else { - # A message starting a new topic, post to default forum for its source - $forumId = $bridge->getDefaultForumId($msg->getSource()); - if ($forumId === false) { - throw new Exception('unrecognized source: ' . $msg->getSource()); - } - - $postType = 'post'; - } - -# FIXME: the subject and body may be charset encoded---need to decode these -# before posting! - - # Post the message to the forum - $postId = $phpbb->postMessage($postType, $forumId, $topicId, $msg); - $bridge->setPostId($messageId, $postId); - } - catch (Exception $e) { - # Bridging failed, unregister message. - $bridge->unregisterMessage($messageId); - throw $e; - } -} -catch (Exception $e) { - print "$e\n"; -} - -?> diff --git a/src/list_post_receive.php b/src/list_post_receive.php new file mode 100644 index 0000000..0896324 --- /dev/null +++ b/src/list_post_receive.php @@ -0,0 +1,81 @@ +getMessageId(); + $inReplyTo = $msg->getInReplyTo(); + $rererences = $msg->getReferences(); + + $bridge = new Bridge(); + $editId = $bridge->registerByMessageId($messageId, $inReplyTo); + + try { + if ($editId === false) { + # This message has already been processed, bail out + print 'Message id already seen, skipping: ' . $messageId . "\n"; + exit; + } + + $phpbb = new PhpBB3(); + + $forumId = $topicId = null; + $postType = null; + + if ($inReplyTo) { + # Possibly a reply to an existing topic + $parentId = $bridge->getPostId($inReplyTo); + if ($parentId === false) { + throw new Exception('unrecognized Reply-To: ' . $inReplyTo); + } + + $ids = $phpbb->getTopicAndForumIds($parentId); + if ($ids === false) { + throw new Exception('unrecognized parent id: ' . $parentId); + } + + # Found the parent's forum and topic, post to those + $forumId = $ids['forum_id']; + $topicId = $ids['topic_id']; + $postType = 'reply'; + } + else { + # A message starting a new topic, post to default forum for its source + $forumId = $bridge->getDefaultForumId($msg->getSource()); + if ($forumId === false) { + throw new Exception('unrecognized source: ' . $msg->getSource()); + } + + $postType = 'post'; + } + +# FIXME: the subject and body may be charset encoded---need to decode these +# before posting! + + # Post the message to the forum + $postId = $phpbb->postMessage($postType, $forumId, $topicId, $msg); + $bridge->setPostId($messageId, $postId); + } + catch (Exception $e) { + # Bridging failed, unregister message. + $bridge->unregisterMessage($editId); + throw $e; + } +} +catch (Exception $e) { + print "$e\n"; +} + +?> -- cgit v1.2.3