* @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;
* @param array $args $_REQUEST args
*
* @return boolean success flag
- *
*/
-
function prepare($args)
{
parent::prepare($args);
$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;
}
// 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
);
$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
);
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
*
* @return void
*/
-
function showMessages()
{
switch($this->format) {
$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;
}
*
* @return array notices
*/
-
function getMessages()
{
$message = new Message();
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest notice in the stream
*/
-
function lastModified()
{
if (!empty($this->messages)) {
*
* @return void
*/
-
function showXmlDirectMessages()
{
$this->initDocument('xml');
*
* @return void
*/
-
function showJsonDirectMessages()
{
$this->initDocument('json');
*
* @return void
*/
-
function showRssDirectMessages()
{
$this->initDocument('rss');
*
* @return void
*/
-
function showAtomDirectMessages()
{
$this->initDocument('atom');
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->messages)) {
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)
return null;
}
-
}