summaryrefslogtreecommitdiff
path: root/lib/twitterapi.php
diff options
context:
space:
mode:
authorCiaranG <ciaran@ciarang.com>2009-03-05 16:18:59 +0000
committerCiaranG <ciaran@ciarang.com>2009-03-05 16:18:59 +0000
commit3c53e821cc545d14807c9197d07e8686028a846d (patch)
treee51f35dc8783ea2ba3c9443d28a55a707330909a /lib/twitterapi.php
parente5345d8d7a5b519cfb24c9e2a971b485b3c1c872 (diff)
parentea0c5f565c9ca4b34c1071a51333f0f842a954b9 (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r--lib/twitterapi.php41
1 files changed, 19 insertions, 22 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index a4d183fcd..74f265cbb 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -60,20 +60,34 @@ class TwitterapiAction extends Action
function twitter_status_array($notice, $include_user=true)
{
-
$profile = $notice->getProfile();
$twitter_status = array();
$twitter_status['text'] = $notice->content;
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
$twitter_status['created_at'] = $this->date_twitter($notice->created);
- $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null;
+ $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
+ intval($notice->reply_to) : null;
$twitter_status['source'] = $this->source_link($notice->source);
$twitter_status['id'] = intval($notice->id);
- $twitter_status['in_reply_to_user_id'] = ($notice->reply_to) ? $this->replier_by_reply(intval($notice->reply_to)) : null;
+
+ $replier_profile = null;
+
+ if ($notice->reply_to) {
+ $reply = Notice::staticGet(intval($notice->reply_to));
+ if ($reply) {
+ $replier_profile = $reply->getProfile();
+ }
+ }
+
+ $twitter_status['in_reply_to_user_id'] =
+ ($replier_profile) ? intval($replier_profile->id) : null;
+ $twitter_status['in_reply_to_screen_name'] =
+ ($replier_profile) ? $replier_profile->nickname : null;
if (isset($this->auth_user)) {
- $twitter_status['favorited'] = ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
+ $twitter_status['favorited'] =
+ ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
} else {
$twitter_status['favorited'] = 'false';
}
@@ -137,7 +151,6 @@ class TwitterapiAction extends Action
function twitter_dmsg_array($message)
{
-
$twitter_dm = array();
$from_profile = $message->getFrom();
@@ -386,23 +399,7 @@ class TwitterapiAction extends Action
$t = strtotime($dt);
return date("D M d G:i:s O Y", $t);
}
-
- function replier_by_reply($reply_id)
- {
- $notice = Notice::staticGet($reply_id);
- if ($notice) {
- $profile = $notice->getProfile();
- if ($profile) {
- return intval($profile->id);
- } else {
- common_debug('Can\'t find a profile for notice: ' . $notice->id, __FILE__);
- }
- } else {
- common_debug("Can't get notice: $reply_id", __FILE__);
- }
- return null;
- }
-
+
// XXX: Candidate for a general utility method somewhere?
function count_subscriptions($profile)
{