From 940737a9585668c5a0167a2e437fba54944f8f10 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 12 Mar 2015 19:22:05 +0100 Subject: [PATCH] Finalize move of 'repeat' Command --- lib/command.php | 32 +---------------------------- plugins/Share/SharePlugin.php | 14 ++++++------- plugins/Share/lib/repeatcommand.php | 29 ++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 38 deletions(-) create mode 100644 plugins/Share/lib/repeatcommand.php diff --git a/lib/command.php b/lib/command.php index efbcf91bfe..94e95f0ee9 100644 --- a/lib/command.php +++ b/lib/command.php @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } +if (!defined('GNUSOCIAL')) { exit(1); } require_once(INSTALLDIR.'/lib/channel.php'); @@ -523,32 +523,6 @@ class WhoisCommand extends Command } } -class RepeatCommand extends Command -{ - var $other = null; - function __construct($user, $other) - { - parent::__construct($user); - $this->other = $other; - } - - function handle($channel) - { - $notice = $this->getNotice($this->other); - - try { - $repeat = $notice->repeat($this->scoped->id, $channel->source()); - $recipient = $notice->getProfile(); - - // TRANS: Message given having repeated a notice from another user. - // TRANS: %s is the name of the user for which the notice was repeated. - $channel->output($this->user, sprintf(_('Notice from %s repeated.'), $recipient->nickname)); - } catch (Exception $e) { - $channel->error($this->user, $e->getMessage()); - } - } -} - class ReplyCommand extends Command { var $other = null; @@ -912,10 +886,6 @@ class HelpCommand extends Command "whois " => _m('COMMANDHELP', "get profile info on user"), // TRANS: Help message for IM/SMS command "lose ". "lose " => _m('COMMANDHELP', "force user to stop following you"), - // TRANS: Help message for IM/SMS command "repeat #". - "repeat #" => _m('COMMANDHELP', "repeat a notice with a given id"), - // TRANS: Help message for IM/SMS command "repeat ". - "repeat " => _m('COMMANDHELP', "repeat the last notice from user"), // TRANS: Help message for IM/SMS command "reply #". "reply #" => _m('COMMANDHELP', "reply to notice with a given id"), // TRANS: Help message for IM/SMS command "reply ". diff --git a/plugins/Share/SharePlugin.php b/plugins/Share/SharePlugin.php index 5972d1b517..ec15f3ebdb 100644 --- a/plugins/Share/SharePlugin.php +++ b/plugins/Share/SharePlugin.php @@ -177,7 +177,7 @@ class SharePlugin extends ActivityVerbHandlerPlugin // API stuff /** - * show the "favorite" form in the notice options element + * show the "repeat" form in the notice options element * FIXME: Don't let a NoticeListItemAdapter slip in here (or extend that from NoticeListItem) * * @return void @@ -219,8 +219,8 @@ class SharePlugin extends ActivityVerbHandlerPlugin } /** - * EndInterpretCommand for FavoritePlugin will handle the 'fav' command - * using the class FavCommand. + * EndInterpretCommand for RepeatPlugin will handle the 'repeat' command + * using the class RepeatCommand. * * @param string $cmd Command being run * @param string $arg Rest of the message (including address) @@ -249,10 +249,10 @@ class SharePlugin extends ActivityVerbHandlerPlugin public function onHelpCommandMessages(HelpCommand $help, array &$commands) { - // TRANS: Help message for IM/SMS command "fav ". - $commands['fav '] = _m('COMMANDHELP', "add user's last notice as a 'fave'"); - // TRANS: Help message for IM/SMS command "fav #". - $commands['fav #'] = _m('COMMANDHELP', "add notice with the given id as a 'fave'"); + // TRANS: Help message for IM/SMS command "repeat #". + $commands['repeat #'] = _m('COMMANDHELP', "repeat a notice with a given id"); + // TRANS: Help message for IM/SMS command "repeat ". + $commands['repeat '] = _m('COMMANDHELP', "repeat the last notice from user"); } /** diff --git a/plugins/Share/lib/repeatcommand.php b/plugins/Share/lib/repeatcommand.php new file mode 100644 index 0000000000..6d2dfb1ec3 --- /dev/null +++ b/plugins/Share/lib/repeatcommand.php @@ -0,0 +1,29 @@ +other = $other; + } + + function handle($channel) + { + $notice = $this->getNotice($this->other); + + try { + $repeat = $notice->repeat($this->scoped->id, $channel->source()); + $recipient = $notice->getProfile(); + + // TRANS: Message given having repeated a notice from another user. + // TRANS: %s is the name of the user for which the notice was repeated. + $channel->output($this->user, sprintf(_('Notice from %s repeated.'), $recipient->nickname)); + } catch (Exception $e) { + $channel->error($this->user, $e->getMessage()); + } + } +} -- 2.39.5