X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fcommand.php;h=3fb4d76c75f131ff74f245362a646cde59d43086;hb=5089d3065c5b2944e468d821a0afdc0881830445;hp=4887cac452ffb09997f889b00f7346d3394f1cf9;hpb=670ad53215eaaa40a55a1977b373a62940c50a42;p=quix0rs-gnu-social.git diff --git a/lib/command.php b/lib/command.php index 4887cac452..3fb4d76c75 100644 --- a/lib/command.php +++ b/lib/command.php @@ -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); @@ -901,7 +900,7 @@ class HelpCommand extends Command function handle($channel) { $channel->output($this->user, - // TRANS: Help text for commands. + // TRANS: Help text for commands. Do not translate the command names themselves; they are fixed strings. _("Commands:\n". "on - turn on notifications\n". "off - turn off notifications\n".