]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapistatuses.php
Merge branch '0.9.x-mobile' of git@gitorious.org:~csarven/statusnet/csarven-clone...
[quix0rs-gnu-social.git] / actions / twitapistatuses.php
index 4a9f4a5e54a7b85eff755cbb6bca219bff4a001e..87043b1821cb47672af710706b63c901014cd9bc 100644 (file)
@@ -17,7 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -136,6 +136,11 @@ class TwitapistatusesAction extends TwitterapiAction
 
     }
 
+    function home_timeline($args, $apidata)
+    {
+        call_user_func(array($this, 'friends_timeline'), $args, $apidata);
+    }
+
     function user_timeline($args, $apidata)
     {
         parent::handle($args);
@@ -242,14 +247,15 @@ class TwitapistatusesAction extends TwitterapiAction
 
             $status_shortened = common_shorten_links($status);
 
-            if (mb_strlen($status_shortened) > 140) {
+            if (Notice::contentTooLong($status_shortened)) {
 
                 // XXX: Twitter truncates anything over 140, flags the status
                 // as "truncated." Sending this error may screw up some clients
                 // that assume Twitter will truncate for them.    Should we just
                 // truncate too? -- Zach
-                $this->clientError(_('That\'s too long. Max notice size is 140 chars.'),
-                    $code = 406, $apidata['content-type']);
+                $this->clientError(sprintf(_('That\'s too long. Max notice size is %d chars.'),
+                                           Notice::maxContent()),
+                                   $code = 406, $apidata['content-type']);
                 return;
             }
         }
@@ -291,11 +297,6 @@ class TwitapistatusesAction extends TwitterapiAction
                 html_entity_decode($status, ENT_NOQUOTES, 'UTF-8'),
                     $source, 1, $reply_to);
 
-            if (is_string($notice)) {
-                $this->serverError($notice);
-                return;
-            }
-
             common_broadcast_notice($notice);
             $apidata['api_arg'] = $notice->id;
         }
@@ -396,8 +397,14 @@ class TwitapistatusesAction extends TwitterapiAction
         } else {
             // XXX: Twitter just sets a 404 header and doens't bother
             // to return an err msg
-            $this->clientError(_('No status with that ID found.'),
-                404, $apidata['content-type']);
+            $deleted = Deleted_notice::staticGet($notice_id);
+            if (!empty($deleted)) {
+                $this->clientError(_('Status deleted.'),
+                                   410, $apidata['content-type']);
+            } else {
+                $this->clientError(_('No status with that ID found.'),
+                                   404, $apidata['content-type']);
+            }
         }
     }