X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapidirectmessage.php;h=e072e27b8319b925aee1296c6663a79e862cc381;hb=b7d07466943a73e1c009467c8daa6e499810080f;hp=53da9e0c68a297195c74c6b33eee1c8a5648539a;hpb=72460091ddc6763cb8d62f9d865390ea4973dd44;p=quix0rs-gnu-social.git diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index 53da9e0c68..e072e27b83 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiDirectMessageAction extends ApiAuthAction { var $messages = null; @@ -64,9 +63,7 @@ class ApiDirectMessageAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -74,6 +71,7 @@ class ApiDirectMessageAction extends ApiAuthAction $this->user = $this->auth_user; if (empty($this->user)) { + // TRANS: Client error given when a user was not found (404). $this->clientError(_('No such user.'), 404, $this->format); return; } @@ -86,10 +84,12 @@ class ApiDirectMessageAction extends ApiAuthAction // Action was called by /api/direct_messages/sent.format $this->title = sprintf( + // TRANS: Title. %s is a user nickname. _("Direct messages from %s"), $this->user->nickname ); $this->subtitle = sprintf( + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent from %s"), $this->user->nickname ); @@ -98,10 +98,12 @@ class ApiDirectMessageAction extends ApiAuthAction $this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id; } else { $this->title = sprintf( + // TRANS: Title. %s is a user nickname. _("Direct messages to %s"), $this->user->nickname ); $this->subtitle = sprintf( + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent to %s"), $this->user->nickname ); @@ -124,7 +126,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -136,7 +137,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showMessages() { switch($this->format) { @@ -153,6 +153,7 @@ class ApiDirectMessageAction extends ApiAuthAction $this->showJsonDirectMessages(); break; default: + // TRANS: Client error given when an API method was not found (404). $this->clientError(_('API method not found.'), $code = 404); break; } @@ -163,7 +164,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return array notices */ - function getMessages() { $message = new Message(); @@ -202,7 +202,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -213,7 +212,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->messages)) { @@ -228,11 +226,11 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - 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); @@ -248,7 +246,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showJsonDirectMessages() { $this->initDocument('json'); @@ -269,7 +266,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showRssDirectMessages() { $this->initDocument('rss'); @@ -304,7 +300,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showAtomDirectMessages() { $this->initDocument('atom'); @@ -346,7 +341,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string etag */ - function etag() { if (!empty($this->messages)) { @@ -356,6 +350,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) @@ -366,5 +361,4 @@ class ApiDirectMessageAction extends ApiAuthAction return null; } - }