From 09fb03a4fb46bc43abdf31835f65ee868c08a697 Mon Sep 17 00:00:00 2001 From: uckelman Date: Thu, 22 Apr 2010 20:40:59 +0000 Subject: Handle quote mode. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6727 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/F2M.php | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/F2M.php b/src/F2M.php index 4c5c904..510cfa4 100644 --- a/src/F2M.php +++ b/src/F2M.php @@ -14,6 +14,19 @@ function send_to_lists($config, $user, $mode, $data, $post_data) { var_dump($post_data); print '

'; + # Check the mode + switch ($mode) { + case 'post': + case 'reply': + case 'quote': + break; # Mail this post + case 'edit': # TODO + case 'delete': # TODO + return; + default: + throw new Exception('unrecognized mode: ' . $mode); + } + require_once('Mail.php'); require_once(__DIR__ . '/Bridge.php'); @@ -52,16 +65,19 @@ function send_to_lists($config, $user, $mode, $data, $post_data) { $inReplyTo = null; $references = null; - if ($mode == 'reply') { - $firstId = $data['topic_first_post_id']; + if ($mode == 'reply' || $mode == 'quote') { + $firstId = $data['topic_first_post_id']; $firstMessageId = $bridge->getMessageId($firstId); if ($firstMessageId === false) { throw new Exception('unrecognized post id: ' . $firstId); } -# FIXME: try to build better References by matching, maybe? +# TODO: try to build better References by matching, maybe? $inReplyTo = $references = $firstMessageId; } + else if ($mode == 'edit') { + $inReplyTo = $bridge->getMessageId($postId); + } $forumURL = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']); @@ -90,6 +106,18 @@ function send_to_lists($config, $user, $mode, $data, $post_data) { $text = htmlspecialchars_decode($text); $text = wordwrap($text, 72); + if ($mode == 'edit') { + $edit_notice = <<registerMessage($postId, $messageId, $inReplyTo, $references); -- cgit v1.2.3