diff options
-rw-r--r-- | src/Bridge.php | 8 | ||||
-rw-r--r-- | src/F2M.php | 3 | ||||
-rw-r--r-- | src/M2F.php | 2 | ||||
-rw-r--r-- | test/BridgeTest.php | 10 |
4 files changed, 9 insertions, 14 deletions
diff --git a/src/Bridge.php b/src/Bridge.php index 0125363..b428fff 100644 --- a/src/Bridge.php +++ b/src/Bridge.php @@ -71,16 +71,14 @@ class Bridge { return $rows; } - public function registerMessage($postId, $messageId, - $inReplyTo, $references) { + public function registerMessage($postId, $messageId, $inReplyTo) { throw_if_null($messageId); $sql = 'INSERT IGNORE INTO posts ' . - '(post_id, message_id, in_reply_to, refs) ' . + '(post_id, message_id, in_reply_to) ' . 'VALUES (' . ($postId === null ? 'NULL' : $postId) . ', ' . $this->db->quote($messageId) . ', ' - . $this->quote($inReplyTo) . ', ' - . $this->quote($references) . ')'; + . $this->quote($inReplyTo) . ')'; $count = $this->db->exec($sql); return $count == 1; diff --git a/src/F2M.php b/src/F2M.php index 445e047..95b26aa 100644 --- a/src/F2M.php +++ b/src/F2M.php @@ -178,8 +178,7 @@ EOF; # FIXME: edited messages break the bijection between post and message ids! # Register the message - $seen = !$bridge->registerMessage($postId, $messageId, - $inReplyTo, $references); + $seen = !$bridge->registerMessage($postId, $messageId, $inReplyTo); if ($seen) { throw new Exception('message id already seen: ' . $messageId); } diff --git a/src/M2F.php b/src/M2F.php index 1f66546..a8d2749 100644 --- a/src/M2F.php +++ b/src/M2F.php @@ -17,7 +17,7 @@ try { $rererences = $msg->getReferences(); $bridge = new Bridge(); - $seen = !$bridge->registerMessage(null, $messageId, $inReplyTo, $references); + $seen = !$bridge->registerMessage(null, $messageId, $inReplyTo); try { if ($seen) { diff --git a/test/BridgeTest.php b/test/BridgeTest.php index 8aaba04..b72d974 100644 --- a/test/BridgeTest.php +++ b/test/BridgeTest.php @@ -21,18 +21,16 @@ class BridgeTest extends PHPUnit_Framework_TestCase { 'post_id MEDIUMINT UNSIGNED, ' . 'message_id VARCHAR(255) NOT NULL, ' . 'in_reply_to VARCHAR(255), ' . - 'refs BLOB, ' . 'UNIQUE KEY (post_id), ' . 'UNIQUE KEY (message_id))' ); $this->db->exec( - 'INSERT INTO posts (post_id, message_id, in_reply_to, refs) ' . + 'INSERT INTO posts (post_id, message_id, in_reply_to) ' . 'VALUES (' . '1, ' . '"<20100302094228.33F0310091@charybdis.ellipsis.cx>", ' . - '"<1267473003.m2f.17543@www.vassalengine.org>", ' . - '"<1267171317.m2f.17507@www.vassalengine.org> <1267473003.m2f.17543@www.vassalengine.org>"' . + '"<1267473003.m2f.17543@www.vassalengine.org>"' . ')' ); @@ -98,13 +96,13 @@ class BridgeTest extends PHPUnit_Framework_TestCase { /** * @dataProvider providerRegisterMessage */ - public function testRegisterMessage($postId, $messageId, $inReplyTo, $refs, + public function testRegisterMessage($postId, $messageId, $inReplyTo, $expected, $ex) { if ($ex) $this->setExpectedException($ex); $bridge = new Bridge($this->db); $this->assertEquals( $expected, - $bridge->registerMessage($postId, $messageId, $inReplyTo, $refs) + $bridge->registerMessage($postId, $messageId, $inReplyTo) ); } |