show repeated notices correctly in API output

This commit is contained in:
Evan Prodromou 2009-12-11 12:39:29 -05:00
parent 0cb1feed51
commit 1c370bb277

View File

@ -213,6 +213,20 @@ class ApiAction extends Action
} }
function twitterStatusArray($notice, $include_user=true) function twitterStatusArray($notice, $include_user=true)
{
$base = $this->twitterSimpleStatusArray($notice, $include_user);
if (empty($notice->repeat_of)) {
return $base;
} else {
$original = Notice::staticGet('id', $notice->repeat_of);
$original_array = $this->twitterSimpleStatusArray($original, $include_user);
$original_array['retweeted_status'] = $base;
return $original_array;
}
}
function twitterSimpleStatusArray($notice, $include_user=true)
{ {
$profile = $notice->getProfile(); $profile = $notice->getProfile();
@ -446,9 +460,9 @@ class ApiAction extends Action
} }
} }
function showTwitterXmlStatus($twitter_status) function showTwitterXmlStatus($twitter_status, $tag='status')
{ {
$this->elementStart('status'); $this->elementStart($tag);
foreach($twitter_status as $element => $value) { foreach($twitter_status as $element => $value) {
switch ($element) { switch ($element) {
case 'user': case 'user':
@ -463,11 +477,14 @@ class ApiAction extends Action
case 'geo': case 'geo':
$this->showGeoRSS($value); $this->showGeoRSS($value);
break; break;
case 'retweeted_status':
$this->showTwitterXmlStatus($value, 'retweeted_status');
break;
default: default:
$this->element($element, null, $value); $this->element($element, null, $value);
} }
} }
$this->elementEnd('status'); $this->elementEnd($tag);
} }
function showTwitterXmlGroup($twitter_group) function showTwitterXmlGroup($twitter_group)