]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into 1.0.x
authorEvan Prodromou <evan@status.net>
Thu, 9 Sep 2010 19:01:03 +0000 (15:01 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 9 Sep 2010 19:01:03 +0000 (15:01 -0400)
Conflicts:
EVENTS.txt
plugins/TwitterBridge/daemons/twitterstatusfetcher.php
plugins/TwitterBridge/twitterbasicauthclient.php

1  2 
EVENTS.txt
README
classes/Notice.php
lib/apiaction.php
lib/common.php
plugins/TwitterBridge/twitteroauthclient.php

diff --combined EVENTS.txt
index 8b7448d6752739db9cc30ed57036f2c76e0092e2,fd2bdb9d566dffe123d8ad6a12cd72d480aeaec8..789c985ae3c2272dd4d343d48e92161044db97cd
@@@ -551,12 -551,6 +551,12 @@@ EndPublicXRDS: End XRDS output (right b
  - $action: the current action
  - &$xrdsoutputter - XRDSOutputter object to write to
  
 +StartHostMetaLinks: Start /.well-known/host-meta links
 +- &links: array containing the links elements to be written
 +
 +EndHostMetaLinks: End /.well-known/host-meta links
 +- &links: array containing the links elements to be written
 +
  StartCheckPassword: Check a username/password
  - $nickname: The nickname to check
  - $password: The password to check
@@@ -722,24 -716,6 +722,24 @@@ StartShowContentLicense: Showing the de
  EndShowContentLicense: Showing the default license for content
  - $action: the current action
  
 +GetImTransports: Get IM transports that are available
 +- &$transports: append your transport to this array like so: $transports[transportName]=array('display'=>display)
 +
 +NormalizeImScreenname: Normalize an IM screenname
 +- $transport: transport the screenname is on
 +- &$screenname: screenname to be normalized
 +
 +ValidateImScreenname: Validate an IM screenname
 +- $transport: transport the screenname is on
 +- $screenname: screenname to be validated
 +- $valid: is the screenname valid?
 +
 +SendImConfirmationCode: Send a confirmation code to confirm a user owns an IM screenname
 +- $transport: transport the screenname exists on
 +- $screenname: screenname being confirmed
 +- $code: confirmation code for confirmation URL
 +- $user: user requesting the confirmation
 +
  StartUserRegister: When a new user is being registered
  - &$profile: new profile data (no ID)
  - &$user: new user account (no ID or URI)
@@@ -1102,3 -1078,11 +1102,11 @@@ StartShowPageTitle: when beginning to s
  
  EndShowPageTitle: when done showing the page title <h1>
  - $action: action being shown
+ StartDeleteOwnNotice: when a user starts to delete their own notice
+ - $user: the user doing the delete
+ - $notice: the notice being deleted
+ EndDeleteOwnNotice: when a user has deleted their own notice
+ - $user: the user doing the delete
+ - $notice: the notice being deleted
diff --combined README
index ed450f08d50ce01b83ea7c7997fa1c149ffa78da,d917cdd80bec8bdaf1f31cf6ab83c1e9a4d2c58d..7294083a98819e7adec6f0231f3d54c9f95ed5bc
--- 1/README
--- 2/README
+++ b/README
@@@ -2,8 -2,8 +2,8 @@@
  README
  ------
  
- StatusNet 0.9.4 "Orange Crush"
- 16 August 2010
+ StatusNet 0.9.5 "What's The Frequency, Kenneth?"
+ 10 September 2010
  
  This is the README file for StatusNet, the Open Source microblogging
  platform. It includes installation instructions, descriptions of
@@@ -856,7 -856,9 +856,7 @@@ sslserver: use an alternate server nam
      parameters correctly so that both the SSL server and the
      "normal" server can access the session cookie and
      preferably other cookies as well.
 -shorturllength: Length of URL at which URLs in a message exceeding 140
 -    characters will be sent to the user's chosen
 -    shortening service.
 +shorturllength: ignored. See 'url' section below.
  dupelimit: minimum time allowed for one person to say the same thing
      twice. Default 60s. Anything lower is considered a user
      or UI error.
@@@ -1479,22 -1481,6 +1479,22 @@@ disallow: Array of (virtual) directorie
      'search', 'message', 'settings', 'admin'. Ignored when site
      is private, in which case the entire site ('/') is disallowed.
  
 +url
 +---
 +
 +Everybody loves URL shorteners. These are some options for fine-tuning
 +how and when the server shortens URLs.
 +
 +shortener: URL shortening service to use by default. Users can override
 +           individually. 'ur1.ca' by default.
 +maxlength: If an URL is strictly longer than this limit, it will be
 +           shortened. Note that the URL shortener service may return an
 +           URL longer than this limit. Defaults to 25. Users can
 +           override. If set to 0, all URLs will be shortened.
 +maxnoticelength: If a notice is strictly longer than this limit, all
 +           URLs in the notice will be shortened. Users can override.
 +           -1 means the text limit for notices.
 +
  Plugins
  =======
  
diff --combined classes/Notice.php
index e3d1e85cb16877d155264f5a6679081ee0282e0f,f1b012465b39cbd2c0766ffe8b211802d4d964b0..4c6efd3eb72e98191c7d1253069ae6055193afcb
@@@ -583,7 -583,9 +583,9 @@@ class Notice extends Memcached_DataObje
          if ($f2p->find()) {
              while ($f2p->fetch()) {
                  $f = File::staticGet($f2p->file_id);
-                 $att[] = clone($f);
+                 if ($f) {
+                     $att[] = clone($f);
+                 }
              }
          }
          return $att;
  
      function getStreamByIds($ids)
      {
 -        $cache = common_memcache();
 +        $cache = Cache::instance();
  
          if (!empty($cache)) {
              $notices = array();
          $c = self::memcache();
  
          if (!empty($c)) {
 -            $ni = $c->get(common_cache_key('notice:who_gets:'.$this->id));
 +            $ni = $c->get(Cache::key('notice:who_gets:'.$this->id));
              if ($ni !== false) {
                  return $ni;
              }
  
          if (!empty($c)) {
              // XXX: pack this data better
 -            $c->set(common_cache_key('notice:who_gets:'.$this->id), $ni);
 +            $c->set(Cache::key('notice:who_gets:'.$this->id), $ni);
          }
  
          return $ni;
  
      function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0)
      {
 -        $cache = common_memcache();
 +        $cache = Cache::instance();
  
          if (empty($cache) ||
              $since_id != 0 || $max_id != 0 ||
                                                                        $max_id)));
          }
  
 -        $idkey = common_cache_key($cachekey);
 +        $idkey = Cache::key($cachekey);
  
          $idstr = $cache->get($idkey);
  
  
      function repeatStream($limit=100)
      {
 -        $cache = common_memcache();
 +        $cache = Cache::instance();
  
          if (empty($cache)) {
              $ids = $this->_repeatStreamDirect($limit);
          } else {
 -            $idstr = $cache->get(common_cache_key('notice:repeats:'.$this->id));
 +            $idstr = $cache->get(Cache::key('notice:repeats:'.$this->id));
              if ($idstr !== false) {
                  $ids = explode(',', $idstr);
              } else {
                  $ids = $this->_repeatStreamDirect(100);
 -                $cache->set(common_cache_key('notice:repeats:'.$this->id), implode(',', $ids));
 +                $cache->set(Cache::key('notice:repeats:'.$this->id), implode(',', $ids));
              }
              if ($limit < 100) {
                  // We do a max of 100, so slice down to limit
  
          if ($tag->find()) {
              while ($tag->fetch()) {
 -                self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, common_keyize($tag->tag));
 -                self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, common_keyize($tag->tag));
 -                self::blow('notice_tag:notice_ids:%s', common_keyize($tag->tag));
 -                self::blow('notice_tag:notice_ids:%s;last', common_keyize($tag->tag));
 +                self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, Cache::keyize($tag->tag));
 +                self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, Cache::keyize($tag->tag));
 +                self::blow('notice_tag:notice_ids:%s', Cache::keyize($tag->tag));
 +                self::blow('notice_tag:notice_ids:%s;last', Cache::keyize($tag->tag));
                  $tag->delete();
              }
          }
diff --combined lib/apiaction.php
index bb39e4e512210852018f175cd304a4d69936d297,5e0cd551876f278dd44493e5c5a462bfff9141f4..b4252db95aaf389c3f160aa84ac6e99866775f98
@@@ -98,8 -98,6 +98,8 @@@ if (!defined('STATUSNET')) 
      exit(1);
  }
  
 +class ApiValidationException extends Exception { }
 +
  /**
   * Contains most of the Twitter-compatible API output functions.
   *
@@@ -303,7 -301,7 +303,7 @@@ class ApiAction extends Actio
  
          // StatusNet-specific
  
-         $twitter_user['statusnet:profile_url'] = $profile->profileurl;
+         $twitter_user['statusnet_profile_url'] = $profile->profileurl;
  
          return $twitter_user;
      }
  
          // StatusNet-specific
  
-         $twitter_status['statusnet:html'] = $notice->rendered;
+         $twitter_status['statusnet_html'] = $notice->rendered;
  
          return $twitter_status;
      }
                  $this->showTwitterXmlStatus($value, 'retweeted_status');
                  break;
              default:
-                 $this->element($element, null, $value);
+                 if (strncmp($element, 'statusnet_', 10) == 0) {
+                     $this->element('statusnet:'.substr($element, 10), null, $value);
+                 } else {
+                     $this->element($element, null, $value);
+                 }
              }
          }
          $this->elementEnd($tag);
          foreach($twitter_user as $element => $value) {
              if ($element == 'status') {
                  $this->showTwitterXmlStatus($twitter_user['status']);
+             } else if (strncmp($element, 'statusnet_', 10) == 0) {
+                 $this->element('statusnet:'.substr($element, 10), null, $value);
              } else {
                  $this->element($element, null, $value);
              }
diff --combined lib/common.php
index 422a639b879a9e4c54b3862c1aa591aa651d65f0,e08d530f0fa34f568032425a7a7461c5ed98962a..0a0f5c6317e4cb90d3ca72b7204e8fa2638aa1c6
@@@ -22,10 -22,10 +22,10 @@@ if (!defined('STATUSNET') && !defined('
  //exit with 200 response, if this is checking fancy from the installer
  if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') {  exit; }
  
- define('STATUSNET_VERSION', '0.9.4');
+ define('STATUSNET_VERSION', '0.9.5');
  define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
  
- define('STATUSNET_CODENAME', 'Orange Crush');
+ define('STATUSNET_CODENAME', 'What\'s The Frequency, Kenneth?');
  
  define('AVATAR_PROFILE_SIZE', 96);
  define('AVATAR_STREAM_SIZE', 48);
@@@ -71,7 -71,6 +71,7 @@@ if (!function_exists('dl')) 
  # global configuration object
  
  require_once('PEAR.php');
 +require_once('PEAR/Exception.php');
  require_once('DB/DataObject.php');
  require_once('DB/DataObject/Cast.php'); # for dates
  
@@@ -128,23 -127,6 +128,23 @@@ require_once INSTALLDIR.'/lib/subs.php'
  require_once INSTALLDIR.'/lib/clientexception.php';
  require_once INSTALLDIR.'/lib/serverexception.php';
  
 +
 +//set PEAR error handling to use regular PHP exceptions
 +function PEAR_ErrorToPEAR_Exception($err)
 +{
 +    //DB_DataObject throws error when an empty set would be returned
 +    //That behavior is weird, and not how the rest of StatusNet works.
 +    //So just ignore those errors.
 +    if ($err->getCode() == DB_DATAOBJECT_ERROR_NODATA) {
 +        return;
 +    }
 +    if ($err->getCode()) {
 +        throw new PEAR_Exception($err->getMessage(), $err->getCode());
 +    }
 +    throw new PEAR_Exception($err->getMessage());
 +}
 +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');
 +
  try {
      StatusNet::init(@$server, @$path, @$conffile);
  } catch (NoConfigException $e) {
index f6ef786752eeca0acfb18d6ee2d871a429e7d82a,876e304259df7818afd5b67f708d80379e428845..dae76ec845c0f9e3d4a307d455e35eb782ac7abf
@@@ -188,7 -188,7 +188,7 @@@ class TwitterOAuthClient extends OAuthC
      }
  
      /**
-      * Calls Twitter's /statuses/friends_timeline API method
+      * Calls Twitter's /statuses/home_timeline API method
       *
       * @param int $since_id show statuses after this id
       * @param int $max_id   show statuses before this id
       *
       * @return mixed an array of statuses
       */
-     function statusesFriendsTimeline($since_id = null, $max_id = null,
-                                      $cnt = null, $page = null)
+     function statusesHomeTimeline($since_id = null, $max_id = null,
+                                   $cnt = null, $page = null)
      {
  
-         $url    = 'https://twitter.com/statuses/friends_timeline.json';
-         $params = array('since_id' => $since_id,
-                         'max_id' => $max_id,
-                         'count' => $cnt,
-                         'page' => $page);
-         $qry    = http_build_query($params);
+         $url    = 'https://twitter.com/statuses/home_timeline.json';
  
-         if (!empty($qry)) {
-             $url .= "?$qry";
+         $params = array('include_entities' => 'true');
+         if (!empty($since_id)) {
+             $params['since_id'] = $since_id;
+         }
+         if (!empty($max_id)) {
+             $params['max_id'] = $max_id;
+         }
+         if (!empty($cnt)) {
+             $params['count'] = $cnt;
+         }
+         if (!empty($page)) {
+             $params['page'] = $page;
          }
  
-         $response = $this->oAuthGet($url);
+         $response = $this->oAuthGet($url, $params);
          $statuses = json_decode($response);
          return $statuses;
      }
  
 +    /**
 +     * Calls Twitter's /statuses/home_timeline API method
 +     *
 +     * @param int $since_id show statuses after this id
 +     * @param int $max_id   show statuses before this id
 +     * @param int $cnt      number of statuses to show
 +     * @param int $page     page number
 +     *
 +     * @return mixed an array of statuses, similar to friends_timeline but including retweets
 +     */
 +    function statusesHomeTimeline($since_id = null, $max_id = null,
 +                                     $cnt = null, $page = null)
 +    {
 +
 +        $url    = 'https://twitter.com/statuses/home_timeline.json';
 +        $params = array('since_id' => $since_id,
 +                        'max_id' => $max_id,
 +                        'count' => $cnt,
 +                        'page' => $page);
 +        $qry    = http_build_query($params);
 +
 +        if (!empty($qry)) {
 +            $url .= "?$qry";
 +        }
 +
 +        $response = $this->oAuthGet($url);
 +        $statuses = json_decode($response);
 +        return $statuses;
 +    }
 +
      /**
       * Calls Twitter's /statuses/friends API method
       *
      {
          $url = "https://twitter.com/statuses/friends.json";
  
-         $params = array('id' => $id,
-                         'user_id' => $user_id,
-                         'screen_name' => $screen_name,
-                         'page' => $page);
-         $qry    = http_build_query($params);
+         $params = array();
  
-         if (!empty($qry)) {
-             $url .= "?$qry";
+         if (!empty($id)) {
+             $params['id'] = $id;
          }
  
-         $response = $this->oAuthGet($url);
+         if (!empty($user_id)) {
+             $params['user_id'] = $user_id;
+         }
+         if (!empty($screen_name)) {
+             $params['screen_name'] = $screen_name;
+         }
+         if (!empty($page)) {
+             $params['page'] = $page;
+         }
+         $response = $this->oAuthGet($url, $params);
          $friends  = json_decode($response);
          return $friends;
      }
      {
          $url = "https://twitter.com/friends/ids.json";
  
-         $params = array('id' => $id,
-                         'user_id' => $user_id,
-                         'screen_name' => $screen_name,
-                         'page' => $page);
-         $qry    = http_build_query($params);
+         $params = array();
  
-         if (!empty($qry)) {
-             $url .= "?$qry";
+         if (!empty($id)) {
+             $params['id'] = $id;
          }
  
-         $response = $this->oAuthGet($url);
+         if (!empty($user_id)) {
+             $params['user_id'] = $user_id;
+         }
+         if (!empty($screen_name)) {
+             $params['screen_name'] = $screen_name;
+         }
+         if (!empty($page)) {
+             $params['page'] = $page;
+         }
+         $response = $this->oAuthGet($url, $params);
          $ids      = json_decode($response);
          return $ids;
      }
  
+     /**
+      * Calls Twitter's /statuses/retweet/id.json API method
+      *
+      * @param int $id id of the notice to retweet
+      *
+      * @return retweeted status
+      */
+     function statusesRetweet($id)
+     {
+         $url = "http://api.twitter.com/1/statuses/retweet/$id.json";
+         $response = $this->oAuthPost($url);
+         $status = json_decode($response);
+         return $status;
+     }
+     /**
+      * Calls Twitter's /favorites/create API method
+      *
+      * @param int $id ID of the status to favorite
+      *
+      * @return object faved status
+      */
+     function favoritesCreate($id)
+     {
+         $url = "http://api.twitter.com/1/favorites/create/$id.json";
+         $response = $this->oAuthPost($url);
+         $status = json_decode($response);
+         return $status;
+     }
+     /**
+      * Calls Twitter's /favorites/destroy API method
+      *
+      * @param int $id ID of the status to unfavorite
+      *
+      * @return object unfaved status
+      */
+     function favoritesDestroy($id)
+     {
+         $url = "http://api.twitter.com/1/favorites/destroy/$id.json";
+         $response = $this->oAuthPost($url);
+         $status = json_decode($response);
+         return $status;
+     }
+     /**
+      * Calls Twitter's /statuses/destroy API method
+      *
+      * @param int $id ID of the status to destroy
+      *
+      * @return object destroyed
+      */
+     function statusesDestroy($id)
+     {
+         $url = "http://api.twitter.com/1/statuses/destroy/$id.json";
+         $response = $this->oAuthPost($url);
+         $status = json_decode($response);
+         return $status;
+     }
  }