- if ($retweeted_item !== false) {
- $retweeted_status = $status;
- $status['user'] = $status['friendica_owner'];
- try {
- $retweeted_status["user"] = api_get_user($a, $retweeted_item["author-id"]);
- } catch (BadRequestException $e) {
- // user not found. should be found?
- /// @todo check if the user should be always found
- $retweeted_status["user"] = [];
- }
+ if ($body != $item['body']) {
+ $quoted_item = $retweeted_item;
+ $retweeted_item = [];
+ }
+ }
+
+ if (empty($retweeted_item) && ($item['owner-id'] == $item['author-id'])) {
+ $announce = api_get_announce($item);
+ if (!empty($announce)) {
+ $retweeted_item = $item;
+ $item = $announce;
+ $status['friendica_owner'] = api_get_user($a, $announce['author-id']);
+ }
+ }
+
+ if (!empty($quoted_item)) {
+ $conv_quoted = api_convert_item($quoted_item);
+ $quoted_status = $status;
+ unset($quoted_status['friendica_author']);
+ unset($quoted_status['friendica_owner']);
+ unset($quoted_status['friendica_activities']);
+ unset($quoted_status['friendica_private']);
+ unset($quoted_status['statusnet_conversation_id']);
+ $quoted_status['text'] = $conv_quoted['text'];
+ $quoted_status['statusnet_html'] = $conv_quoted['html'];
+ try {
+ $quoted_status["user"] = api_get_user($a, $quoted_item["author-id"]);
+ } catch (BadRequestException $e) {
+ // user not found. should be found?
+ /// @todo check if the user should be always found
+ $quoted_status["user"] = [];
+ }
+ }
+
+ if (!empty($retweeted_item)) {
+ $retweeted_status = $status;
+ unset($retweeted_status['friendica_author']);
+ unset($retweeted_status['friendica_owner']);
+ unset($retweeted_status['friendica_activities']);
+ unset($retweeted_status['friendica_private']);
+ unset($retweeted_status['statusnet_conversation_id']);
+ $status['user'] = $status['friendica_owner'];
+ try {
+ $retweeted_status["user"] = api_get_user($a, $retweeted_item["author-id"]);
+ } catch (BadRequestException $e) {
+ // user not found. should be found?
+ /// @todo check if the user should be always found
+ $retweeted_status["user"] = [];
+ }
+
+ $rt_converted = api_convert_item($retweeted_item);
+
+ $retweeted_status['text'] = $rt_converted["text"];
+ $retweeted_status['statusnet_html'] = $rt_converted["html"];
+ $retweeted_status['created_at'] = api_date($retweeted_item['created']);
+
+ if (!empty($quoted_status)) {
+ $retweeted_status['quoted_status'] = $quoted_status;
+ }