]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apidirectmessagenew.php
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / apidirectmessagenew.php
index 6984c8d1031148231fed49d2229ffd16992d2a44..b9ac92d77bfc01bb91f87ec67ddde184b48f8347 100644 (file)
@@ -21,6 +21,9 @@
  *
  * @category  API
  * @package   StatusNet
+ * @author    Adrian Lang <mail@adrianlang.de>
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Robin Millette <robin@millette.info>
  * @author    Zach Copley <zach@status.net>
  * @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 <mail@adrianlang.de>
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Robin Millette <robin@millette.info>
  * @author   Zach Copley <zach@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
@@ -47,7 +53,6 @@ require_once INSTALLDIR.'/lib/apiauth.php';
 class ApiDirectMessageNewAction extends ApiAuthAction
 {
     var $source  = null;
-    var $user    = null;
     var $other   = null;
     var $content = null;
 
@@ -67,14 +72,14 @@ class ApiDirectMessageNewAction extends ApiAuthAction
         $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)) {
+        if (empty($this->source) || in_array($this->source, $reserved_sources)) {
             $source = 'api';
         }
 
@@ -151,8 +156,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;
@@ -170,7 +175,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
             return;
         }
 
-        mail_notify_message($message, $this->user, $this->other);
+        $message->notify();
 
         if ($this->format == 'xml') {
             $this->showSingleXmlDirectMessage($message);