]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apidirectmessage.php
use library function to determine if https should be used for recaptcha
[quix0rs-gnu-social.git] / actions / apidirectmessage.php
index a21fe86d20269268faf5fb3d1c4cc89b9a84990b..4e2ec5eb08d88286fde2078788fb6f6f9e7c3833 100644 (file)
@@ -74,22 +74,25 @@ class ApiDirectMessageAction extends ApiAuthAction
         $this->user = $this->auth_user;
 
         if (empty($this->user)) {
-            $this->clientError(_('No such user!'), 404, $this->format);
+            // TRANS: Client error given when a user was not found (404).
+            $this->clientError(_('No such user.'), 404, $this->format);
             return;
         }
 
         $server   = common_root_url();
-        $taguribase = common_config('integration', 'taguri');
+        $taguribase = TagURI::base();
 
         if ($this->arg('sent')) {
 
             // Action was called by /api/direct_messages/sent.format
 
             $this->title = sprintf(
+                // TRANS: %s is a user nickname.
                 _("Direct messages from %s"),
                 $this->user->nickname
             );
             $this->subtitle = sprintf(
+                // TRANS: %s is a user nickname.
                 _("All the direct messages sent from %s"),
                 $this->user->nickname
             );
@@ -98,10 +101,12 @@ class ApiDirectMessageAction extends ApiAuthAction
             $this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id;
         } else {
             $this->title = sprintf(
+                // TRANS: %s is a user nickname.
                 _("Direct messages to %s"),
                 $this->user->nickname
             );
             $this->subtitle = sprintf(
+                // TRANS: %s is a user nickname.
                 _("All the direct messages sent to %s"),
                 $this->user->nickname
             );
@@ -153,7 +158,8 @@ class ApiDirectMessageAction extends ApiAuthAction
             $this->showJsonDirectMessages();
             break;
         default:
-            $this->clientError(_('API method not found!'), $code = 404);
+            // TRANS: Client error given when an API method was not found (404).
+            $this->clientError(_('API method not found.'), $code = 404);
             break;
         }
     }
@@ -182,11 +188,6 @@ class ApiDirectMessageAction extends ApiAuthAction
             $message->whereAdd('id > ' . $this->since_id);
         }
 
-        if (!empty($since)) {
-            $d = date('Y-m-d H:i:s', $this->since);
-            $message->whereAdd("created > '$d'");
-        }
-
         $message->orderBy('created DESC, id DESC');
         $message->limit((($this->page - 1) * $this->count), $this->count);
         $message->find();
@@ -237,7 +238,8 @@ class ApiDirectMessageAction extends ApiAuthAction
     function showXmlDirectMessages()
     {
         $this->initDocument('xml');
-        $this->elementStart('direct-messages', array('type' => 'array'));
+        $this->elementStart('direct-messages', array('type' => 'array',
+                                                     'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
 
         foreach ($this->messages as $m) {
             $dm_array = $this->directMessageArray($m);
@@ -361,6 +363,7 @@ class ApiDirectMessageAction extends ApiAuthAction
             return '"' . implode(
                 ':',
                 array($this->arg('action'),
+                      common_user_cache_hash($this->auth_user),
                       common_language(),
                       strtotime($this->messages[0]->created),
                       strtotime($this->messages[$last]->created)