X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapidirectmessagenew.php;h=65d065648ff0337483a3fd5add842546b2133230;hb=6d8e01ad13dd9bc9e149f43a1eb88671d4737f4d;hp=d836409ae01686d363e6577df319e2aab0211b60;hpb=daa8b47306626b2b26b2d48a54449cd7394fc22e;p=quix0rs-gnu-social.git diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php index d836409ae0..65d065648f 100644 --- a/actions/apidirectmessagenew.php +++ b/actions/apidirectmessagenew.php @@ -21,6 +21,9 @@ * * @category API * @package StatusNet + * @author Adrian Lang + * @author Evan Prodromou + * @author Robin Millette * @author Zach Copley * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 @@ -31,7 +34,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/apiauth.php'; +require_once INSTALLDIR . '/lib/apiauth.php'; /** * Creates a new direct message from the authenticating user to @@ -39,6 +42,9 @@ require_once INSTALLDIR.'/lib/apiauth.php'; * * @category API * @package StatusNet + * @author Adrian Lang + * @author Evan Prodromou + * @author Robin Millette * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ @@ -46,9 +52,6 @@ require_once INSTALLDIR.'/lib/apiauth.php'; class ApiDirectMessageNewAction extends ApiAuthAction { - var $format = null; - var $source = null; - var $user = null; var $other = null; var $content = null; @@ -65,26 +68,13 @@ class ApiDirectMessageNewAction extends ApiAuthAction { parent::prepare($args); - if ($this->requiresAuth()) { - if ($this->checkBasicAuthUser() == false) { - return; - } - } - $this->user = $this->auth_user; if (empty($this->user)) { - $this->clientError(_('No such user!'), 404, $this->format); + $this->clientError(_('No such user.'), 404, $this->format); return; } - $this->source = $this->trimmed('source'); // Not supported by Twitter. - - $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api'); - if (empty($thtis->source) || in_array($this->source, $reserved_sources)) { - $source = 'api'; - } - $this->content = $this->trimmed('text'); $this->user = $this->auth_user; @@ -97,8 +87,6 @@ class ApiDirectMessageNewAction extends ApiAuthAction $this->other = $this->getTargetUser($user_param); } - $this->format = $this->arg('format'); - return true; } @@ -160,8 +148,8 @@ class ApiDirectMessageNewAction extends ApiAuthAction // Note: sending msgs to yourself is allowed by Twitter - $errmsg = 'Don\'t send a message to yourself; ' . - 'just say it to yourself quietly instead.' + $errmsg = 'Don\'t send a message to yourself; ' . + 'just say it to yourself quietly instead.'; $this->clientError(_($errmsg), 403, $this->format); return; @@ -179,7 +167,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction return; } - mail_notify_message($message, $this->user, $this->other); + $message->notify(); if ($this->format == 'xml') { $this->showSingleXmlDirectMessage($message);