summaryrefslogtreecommitdiff
path: root/actions/twitapistatuses.php
diff options
context:
space:
mode:
authorzach <zach@copley.name>2008-08-15 14:53:17 -0400
committerzach <zach@copley.name>2008-08-15 14:53:17 -0400
commit35d17146213228445b0f30548aca01c9e1a71154 (patch)
tree3fb1cd320e7f69a3a55b984cdac97a06b943aac5 /actions/twitapistatuses.php
parenta95242bd1d59d87481bb56c9451a348361fc2350 (diff)
Twitter-compatible API: support for new in_reply_to_status_id in statuses/update
darcs-hash:20080815185317-ca946-11c3f9f7255180d5d6ea7b115b3e33b2abb7fe93.gz
Diffstat (limited to 'actions/twitapistatuses.php')
-rw-r--r--actions/twitapistatuses.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index b2bbb16f0..3f9e93073 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -375,9 +375,9 @@ class TwitapistatusesAction extends TwitterapiAction {
parent::handle($args);
$user = $apidata['user'];
-
$status = $this->trimmed('status');
$source = $this->trimmed('source');
+ $in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id'));
if (!$source) {
$source = 'api';
@@ -397,16 +397,30 @@ class TwitapistatusesAction extends TwitterapiAction {
// as "truncated." Sending this error may screw up some clients
// that assume Twitter will truncate for them. Should we just
// truncate too? -- Zach
- header('HTTP/1.1 406 Not Acceptable');
- print "That's too long. Max notice size is 140 chars.\n";
+ $this->client_error('That\'s too long. Max notice size is 140 chars.', $code = 406, $apidata['content-type']);
exit();
}
- $notice = Notice::saveNew($user->id, $status, $source);
+ $reply_to = NULL;
+
+ if ($in_reply_to_status_id) {
+
+ // check whether notice actually exists
+ $reply = Notice::staticGet($in_reply_to_status_id);
+
+ if ($reply) {
+ $reply_to = $in_reply_to_status_id;
+ } else {
+ $this->client_error('Not found', $code = 404, $apidata['content-type']);
+ exit();
+ }
+ }
+
+ $notice = Notice::saveNew($user->id, $status, $source, 1, $reply_to);
if (is_string($notice)) {
$this->server_error($notice);
- return;
+ exit();
}
common_broadcast_notice($notice);