]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/command.php
add --all and --suspicious options for update-profile-data.php
[quix0rs-gnu-social.git] / lib / command.php
index b1f95fcb69232f19b4cfdc20e30ec68931d4b6b1..3fb4d76c75f131ff74f245362a646cde59d43086 100644 (file)
@@ -23,7 +23,6 @@ require_once(INSTALLDIR.'/lib/channel.php');
 
 class Command
 {
-
     var $user = null;
 
     function __construct($user=null)
@@ -49,7 +48,6 @@ class Command
         }
     }
 
-
     /**
      * Override this with the meat!
      *
@@ -141,7 +139,7 @@ class Command
     {
         $user = null;
         if (Event::handle('StartCommandGetUser', array($this, $arg, &$user))) {
-            $user = User::staticGet('nickname', $arg);
+            $user = User::staticGet('nickname', Nickname::normalize($arg));
         }
         Event::handle('EndCommandGetUser', array($this, $arg, &$user));
         if (!$user){
@@ -313,7 +311,6 @@ class FavCommand extends Command
         // TRANS: Text shown when a notice has been marked as favourite successfully.
         $channel->output($this->user, _('Notice marked as fave.'));
     }
-
 }
 
 class JoinCommand extends Command
@@ -361,8 +358,8 @@ class JoinCommand extends Command
                                               $cur->nickname,
                                               $group->nickname));
     }
-
 }
+
 class DropCommand extends Command
 {
     var $other = null;
@@ -409,7 +406,6 @@ class DropCommand extends Command
                                               $cur->nickname,
                                               $group->nickname));
     }
-
 }
 
 class WhoisCommand extends Command
@@ -427,7 +423,7 @@ class WhoisCommand extends Command
 
         // TRANS: Whois output.
         // TRANS: %1$s nickname of the queried user, %2$s is their profile URL.
-        $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
+        $whois = sprintf(_m('WHOIS',"%1\$s (%2\$s)"), $recipient->nickname,
                          $recipient->profileurl);
         if ($recipient->fullname) {
             // TRANS: Whois output. %s is the full name of the queried user.
@@ -471,6 +467,7 @@ class MessageCommand extends Command
                 throw $e;
             }
             // TRANS: Command exception text shown when trying to send a direct message to a remote user (a user not registered at the current server).
+            // TRANS: %s is a remote profile.
             throw new CommandException(sprintf(_('%s is a remote profile; you can only send direct messages to users on the same server.'), $this->other));
         }
 
@@ -482,13 +479,15 @@ class MessageCommand extends Command
             return;
         }
 
-        $this->text = common_shorten_links($this->text);
+        $this->text = $this->user->shortenLinks($this->text);
 
         if (Message::contentTooLong($this->text)) {
             // XXX: i18n. Needs plural support.
-            // TRANS: Message given if content is too long.
+            // TRANS: Message given if content is too long. %1$sd is used for plural.
             // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
-            $channel->error($this->user, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d.'),
+            $channel->error($this->user, sprintf(_m('Message too long - maximum is %1$d character, you sent %2$d.',
+                                                    'Message too long - maximum is %1$d characters, you sent %2$d.',
+                                                    Message::maxContent()),
                                                  Message::maxContent(), mb_strlen($this->text)));
             return;
         }
@@ -583,13 +582,15 @@ class ReplyCommand extends Command
             return;
         }
 
-        $this->text = common_shorten_links($this->text);
+        $this->text = $this->user->shortenLinks($this->text);
 
         if (Notice::contentTooLong($this->text)) {
             // XXX: i18n. Needs plural support.
-            // TRANS: Message given if content of a notice for a reply is too long.
+            // TRANS: Message given if content of a notice for a reply is too long. %1$d is used for plural.
             // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
-            $channel->error($this->user, sprintf(_('Notice too long - maximum is %1$d characters, you sent %2$d.'),
+            $channel->error($this->user, sprintf(_m('Notice too long - maximum is %1$d character, you sent %2$d.',
+                                                    'Notice too long - maximum is %1$d characters, you sent %2$d.',
+                                                    Notice::maxContent()),
                                                  Notice::maxContent(), mb_strlen($this->text)));
             return;
         }
@@ -611,7 +612,6 @@ class ReplyCommand extends Command
 
 class GetCommand extends Command
 {
-
     var $other = null;
 
     function __construct($user, $other)
@@ -638,7 +638,6 @@ class GetCommand extends Command
 
 class SubCommand extends Command
 {
-
     var $other = null;
 
     function __construct($user, $other)
@@ -678,7 +677,6 @@ class SubCommand extends Command
 
 class UnsubCommand extends Command
 {
-
     var $other = null;
 
     function __construct($user, $other)
@@ -712,6 +710,7 @@ class UnsubCommand extends Command
 class OffCommand extends Command
 {
     var $other = null;
+
     function __construct($user, $other=null)
     {
         parent::__construct($user);