]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
- Add profile_info tag to Atom author
authorZach Copley <zach@status.net>
Tue, 22 Jun 2010 23:28:06 +0000 (16:28 -0700)
committerZach Copley <zach@status.net>
Tue, 22 Jun 2010 23:28:06 +0000 (16:28 -0700)
- Normalize xmlns:statusnet links in the API

classes/Notice.php
classes/Profile.php
lib/apiaction.php
lib/atomnoticefeed.php

index f8eda5777d5832400cb52488da19afedc31cea00..c752e35a72305135b7dbcdebd6d1e46c93b84651 100644 (file)
@@ -1190,7 +1190,7 @@ class Notice extends Memcached_DataObject
                            'xmlns:media' => 'http://purl.org/syndication/atommedia',
                            'xmlns:poco' => 'http://portablecontacts.net/spec/1.0',
                            'xmlns:ostatus' => 'http://ostatus.org/schema/1.0',
-                           'xmlns:statusnet' => 'http://status.net/ont/');
+                           'xmlns:statusnet' => 'http://status.net/schema/api/1/');
         } else {
             $attrs = array();
         }
@@ -1225,7 +1225,7 @@ class Notice extends Memcached_DataObject
         $xs->element('title', null, common_xml_safe_str($this->content));
 
         if ($author) {
-            $xs->raw($profile->asAtomAuthor());
+            $xs->raw($profile->asAtomAuthor($cur));
             $xs->raw($profile->asActivityActor());
         }
 
index 54f557ea7cee40201f631ca7aa1416731b3693b4..a303469e96851652b18b49009f7aeda5a7fc063c 100644 (file)
@@ -849,15 +849,23 @@ class Profile extends Memcached_DataObject
      *
      * Assumes that Atom has been previously set up as the base namespace.
      *
+     * @param Profile $cur the current authenticated user
+     *
      * @return string
      */
-    function asAtomAuthor()
+    function asAtomAuthor($cur = null)
     {
         $xs = new XMLStringer(true);
 
         $xs->elementStart('author');
         $xs->element('name', null, $this->nickname);
         $xs->element('uri', null, $this->getUri());
+        if ($cur != null) {
+            $attrs = Array();
+            $attrs['following'] = $cur->isSubscribed($this) ? 'true' : 'false';
+            $attrs['blocking']  = $cur->hasBlocked($this) ? 'true' : 'false';
+            $xs->element('statusnet:profile_info', $attrs, null);
+        }
         $xs->elementEnd('author');
 
         return $xs->getString();
index 7cc473d51210c90fc8230879800b7c06107fe36b..226481778ea3981ac89e1cc71a64346d2c310922 100644 (file)
@@ -208,11 +208,13 @@ class ApiAction extends Action
 
         // Is the requesting user following this user?
         $twitter_user['following'] = false;
+        $twitter_user['statusnet:blocking'] = false;
         $twitter_user['notifications'] = false;
 
         if (isset($this->auth_user)) {
 
             $twitter_user['following'] = $this->auth_user->isSubscribed($profile);
+            $twitter_user['statusnet:blocking']  = $this->auth_user->hasBlocked($profile);
 
             // Notifications on?
             $sub = Subscription::pkeyGet(array('subscriber' =>
index ef44de4b6ce615bdafe4fc7e34f315ed06bceb01..6ed803ce4ebb35a0350f669b26fc098b896a3585 100644 (file)
@@ -95,7 +95,7 @@ class AtomNoticeFeed extends Atom10Feed
 
         $this->addNamespace(
             'statusnet',
-            'http://status.net/ont/'
+            'http://status.net/schema/api/1/'
         );
     }