summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/profilelist.php20
-rw-r--r--lib/router.php2
-rw-r--r--lib/twitterapi.php61
3 files changed, 72 insertions, 11 deletions
diff --git a/lib/profilelist.php b/lib/profilelist.php
index e13d56a9a..774538a4b 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -243,20 +243,20 @@ class ProfileListItem extends Widget
$user = common_current_user();
if (!empty($user) && $this->profile->id != $user->id) {
- // Is it a local user? can't remote sub from a list
- // XXX: make that possible!
- $other = User::staticGet('id', $this->profile->id);
- if (!empty($other)) {
- $this->out->elementStart('li', 'entity_subscribe');
- if ($user->isSubscribed($this->profile)) {
- $usf = new UnsubscribeForm($this->out, $this->profile);
- $usf->show();
- } else {
+ $this->out->elementStart('li', 'entity_subscribe');
+ if ($user->isSubscribed($this->profile)) {
+ $usf = new UnsubscribeForm($this->out, $this->profile);
+ $usf->show();
+ } else {
+ // Is it a local user? can't remote sub from a list
+ // XXX: make that possible!
+ $other = User::staticGet('id', $this->profile->id);
+ if (!empty($other)) {
$sf = new SubscribeForm($this->out, $this->profile);
$sf->show();
}
- $this->out->elementEnd('li');
}
+ $this->out->elementEnd('li');
}
}
diff --git a/lib/router.php b/lib/router.php
index 784ea9882..50b733453 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -317,7 +317,7 @@ class Router
$m->connect('api/friendships/:method',
array('action' => 'api',
'apiaction' => 'friendships'),
- array('method' => 'exists(\.(xml|json))'));
+ array('method' => '(show|exists)(\.(xml|json))'));
// Social graph
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index f538a0298..40e5b5067 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -278,6 +278,67 @@ class TwitterapiAction extends Action
return $twitter_dm;
}
+ function twitter_relationship_array($source, $target)
+ {
+ $relationship = array();
+
+ $relationship['source'] =
+ $this->relationship_details_array($source, $target);
+ $relationship['target'] =
+ $this->relationship_details_array($target, $source);
+
+ return array('relationship' => $relationship);
+ }
+
+ function relationship_details_array($source, $target)
+ {
+ $details = array();
+
+ $details['screen_name'] = $source->nickname;
+ $details['followed_by'] = $target->isSubscribed($source);
+ $details['following'] = $source->isSubscribed($target);
+
+ $notifications = false;
+
+ if ($source->isSubscribed($target)) {
+
+ $sub = Subscription::pkeyGet(array('subscriber' =>
+ $source->id, 'subscribed' => $target->id));
+
+ if (!empty($sub)) {
+ $notifications = ($sub->jabber || $sub->sms);
+ }
+ }
+
+ $details['notifications_enabled'] = $notifications;
+ $details['blocking'] = $source->hasBlocked($target);
+ $details['id'] = $source->id;
+
+ return $details;
+ }
+
+ function show_twitter_xml_relationship($relationship)
+ {
+ $this->elementStart('relationship');
+
+ foreach($relationship as $element => $value) {
+ if ($element == 'source' || $element == 'target') {
+ $this->elementStart($element);
+ $this->show_xml_relationship_details($value);
+ $this->elementEnd($element);
+ }
+ }
+
+ $this->elementEnd('relationship');
+ }
+
+ function show_xml_relationship_details($details)
+ {
+ foreach($details as $element => $value) {
+ $this->element($element, null, $value);
+ }
+ }
+
function show_twitter_xml_status($twitter_status)
{
$this->elementStart('status');