summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-11 12:39:29 -0500
committerEvan Prodromou <evan@status.net>2009-12-11 12:39:29 -0500
commit1c370bb277d9b707a5f1956dd5e6856a9b278f5e (patch)
treea2c944735d8214401324bd4b04d4cad53ca2bd1f
parent0cb1feed51522abc35bfd4252089ca8c4df52bda (diff)
show repeated notices correctly in API output
-rw-r--r--lib/api.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/api.php b/lib/api.php
index eacb80dbe..12e3ba531 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -214,6 +214,20 @@ class ApiAction extends Action
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();
$twitter_status = array();
@@ -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) {
switch ($element) {
case 'user':
@@ -463,11 +477,14 @@ class ApiAction extends Action
case 'geo':
$this->showGeoRSS($value);
break;
+ case 'retweeted_status':
+ $this->showTwitterXmlStatus($value, 'retweeted_status');
+ break;
default:
$this->element($element, null, $value);
}
}
- $this->elementEnd('status');
+ $this->elementEnd($tag);
}
function showTwitterXmlGroup($twitter_group)