]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapidirect_messages.php
Profile block base style
[quix0rs-gnu-social.git] / actions / twitapidirect_messages.php
index a04ae5fa76f0c795ea858051e062052f4768333a..535795ca4321d6351edca4dbe6d2d2e3ced8ef2b 100644 (file)
@@ -40,6 +40,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
                $count = $this->arg('count');
                $since = $this->arg('since');
                $since_id = $this->arg('since_id');
+               $before_id = $this->arg('before_id');
+
                $page = $this->arg('page');
 
                if (!$page) {
@@ -69,6 +71,21 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
                        $link = $server . $user->nickname . '/outbox';
                }
 
+               if ($before_id) {
+                       $message->whereAdd("id < $before_id");
+               }
+
+               if ($since_id) {
+                       $message->whereAdd("id > $since_id");
+               }
+
+               $since = strtotime($this->arg('since'));
+
+               if ($since) {
+                       $d = date('Y-m-d H:i:s', $since);
+                       $message->whereAdd("created > '$d'");
+               }
+
                $message->orderBy('created DESC, id DESC');
                $message->limit((($page-1)*20), $count);
                $message->find();
@@ -102,7 +119,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
                }
 
                $user = $apidata['user'];
-               $source = $this->trimmed('source');  // Not supported by Twitter.
+               $source = $this->trimmed('source');      // Not supported by Twitter.
 
         $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api');
                if (!$source || in_array($source, $reserved_sources)) {
@@ -113,10 +130,9 @@ class Twitapidirect_messagesAction extends TwitterapiAction {
 
                if (!$content) {
                        $this->client_error(_('No message text!'), $code = 406, $apidata['content-type']);
-//             } else if (mb_strlen($status) > 140) {
                } else {
-                       $status = common_shorten_links($status);
-                       if (mb_strlen($status) > 140) {
+                       $content_shortened = common_shorten_links($content);
+                       if (mb_strlen($content_shortened) > 140) {
                                $this->client_error(_('That\'s too long. Max message size is 140 chars.'),
                                        $code = 406, $apidata['content-type']);
                                return;