3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, 2010 StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
22 require_once(INSTALLDIR.'/lib/channel.php');
28 function __construct($user=null)
34 * Execute the command and send success or error results
35 * back via the given communications channel.
39 public function execute($channel)
42 $this->handle($channel);
43 } catch (CommandException $e) {
44 $channel->error($this->user, $e->getMessage());
45 } catch (Exception $e) {
46 common_log(LOG_ERR, "Error handling " . get_class($this) . ": " . $e->getMessage());
47 $channel->error($this->user, $e->getMessage());
52 * Override this with the meat!
54 * An error to send back to the user may be sent by throwing
55 * a CommandException with a formatted message.
58 * @throws CommandException
60 function handle($channel)
66 * Look up a notice from an argument, by poster's name to get last post
67 * or notice_id prefixed with #.
70 * @throws CommandException
72 function getNotice($arg)
75 if (Event::handle('StartCommandGetNotice', array($this, $arg, &$notice))) {
76 if(substr($this->other,0,1)=='#'){
77 // A specific notice_id #123
79 $notice = Notice::staticGet(substr($arg,1));
81 // TRANS: Command exception text shown when a notice ID is requested that does not exist.
82 throw new CommandException(_('Notice with that id does not exist.'));
86 if (Validate::uri($this->other)) {
87 // A specific notice by URI lookup
88 $notice = Notice::staticGet('uri', $arg);
92 // Local or remote profile name to get their last notice.
93 // May throw an exception and report 'no such user'
94 $recipient = $this->getProfile($arg);
96 $notice = $recipient->getCurrentNotice();
98 // TRANS: Command exception text shown when a last user notice is requested and it does not exist.
99 throw new CommandException(_('User has no last notice.'));
103 Event::handle('EndCommandGetNotice', array($this, $arg, &$notice));
105 // TRANS: Command exception text shown when a notice ID is requested that does not exist.
106 throw new CommandException(_('Notice with that id does not exist.'));
112 * Look up a local or remote profile by nickname.
115 * @throws CommandException
117 function getProfile($arg)
120 if (Event::handle('StartCommandGetProfile', array($this, $arg, &$profile))) {
122 common_relative_profile($this->user, common_canonical_nickname($arg));
124 Event::handle('EndCommandGetProfile', array($this, $arg, &$profile));
126 // TRANS: Message given requesting a profile for a non-existing user.
127 // TRANS: %s is the nickname of the user for which the profile could not be found.
128 throw new CommandException(sprintf(_('Could not find a user with nickname %s.'), $arg));
134 * Get a local user by name
136 * @throws CommandException
138 function getUser($arg)
141 if (Event::handle('StartCommandGetUser', array($this, $arg, &$user))) {
142 $user = User::staticGet('nickname', Nickname::normalize($arg));
144 Event::handle('EndCommandGetUser', array($this, $arg, &$user));
146 // TRANS: Message given getting a non-existing user.
147 // TRANS: %s is the nickname of the user that could not be found.
148 throw new CommandException(sprintf(_('Could not find a local user with nickname %s.'),
155 * Get a local or remote group by name.
157 * @throws CommandException
159 function getGroup($arg)
162 if (Event::handle('StartCommandGetGroup', array($this, $arg, &$group))) {
163 $group = User_group::getForNickname($arg, $this->user->getProfile());
165 Event::handle('EndCommandGetGroup', array($this, $arg, &$group));
167 // TRANS: Command exception text shown when a group is requested that does not exist.
168 throw new CommandException(_('No such group.'));
174 class CommandException extends Exception
178 class UnimplementedCommand extends Command
180 function handle($channel)
182 // TRANS: Error text shown when an unimplemented command is given.
183 $channel->error($this->user, _("Sorry, this command is not yet implemented."));
187 class TrackingCommand extends UnimplementedCommand
191 class TrackOffCommand extends UnimplementedCommand
195 class TrackCommand extends UnimplementedCommand
198 function __construct($user, $word)
200 parent::__construct($user);
205 class UntrackCommand extends UnimplementedCommand
208 function __construct($user, $word)
210 parent::__construct($user);
215 class NudgeCommand extends Command
218 function __construct($user, $other)
220 parent::__construct($user);
221 $this->other = $other;
224 function handle($channel)
226 $recipient = $this->getUser($this->other);
227 if ($recipient->id == $this->user->id) {
228 // TRANS: Command exception text shown when a user tries to nudge themselves.
229 throw new CommandException(_('It does not make a lot of sense to nudge yourself!'));
231 if ($recipient->email && $recipient->emailnotifynudge) {
232 mail_notify_nudge($this->user, $recipient);
235 // XXX: notify by SMS
236 // TRANS: Message given having nudged another user.
237 // TRANS: %s is the nickname of the user that was nudged.
238 $channel->output($this->user, sprintf(_('Nudge sent to %s.'),
239 $recipient->nickname));
244 class InviteCommand extends UnimplementedCommand
247 function __construct($user, $other)
249 parent::__construct($user);
250 $this->other = $other;
254 class StatsCommand extends Command
256 function handle($channel)
258 $profile = $this->user->getProfile();
260 $subs_count = $profile->subscriptionCount();
261 $subbed_count = $profile->subscriberCount();
262 $notice_count = $profile->noticeCount();
264 // TRANS: User statistics text.
265 // TRANS: %1$s is the number of other user the user is subscribed to.
266 // TRANS: %2$s is the number of users that are subscribed to the user.
267 // TRANS: %3$s is the number of notices the user has sent.
268 $channel->output($this->user, sprintf(_("Subscriptions: %1\$s\n".
269 "Subscribers: %2\$s\n".
277 class FavCommand extends Command
281 function __construct($user, $other)
283 parent::__construct($user);
284 $this->other = $other;
287 function handle($channel)
289 $notice = $this->getNotice($this->other);
292 $fave->user_id = $this->user->id;
293 $fave->notice_id = $notice->id;
296 if ($fave->fetch()) {
297 // TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
298 $channel->error($this->user, _('Could not create favorite: already favorited.'));
302 $fave = Fave::addNew($this->user->getProfile(), $notice);
305 // TRANS: Error message text shown when a favorite could not be set.
306 $channel->error($this->user, _('Could not create favorite.'));
310 // @fixme favorite notification should be triggered
313 $other = User::staticGet('id', $notice->profile_id);
315 if ($other && $other->id != $this->user->id) {
316 if ($other->email && $other->emailnotifyfav) {
317 mail_notify_fave($other, $this->user, $notice);
321 $this->user->blowFavesCache();
323 // TRANS: Text shown when a notice has been marked as favourite successfully.
324 $channel->output($this->user, _('Notice marked as fave.'));
328 class JoinCommand extends Command
332 function __construct($user, $other)
334 parent::__construct($user);
335 $this->other = $other;
338 function handle($channel)
340 $group = $this->getGroup($this->other);
343 if ($cur->isMember($group)) {
344 // TRANS: Error text shown a user tries to join a group they already are a member of.
345 $channel->error($cur, _('You are already a member of that group.'));
348 if (Group_block::isBlocked($group, $cur->getProfile())) {
349 // TRANS: Error text shown when a user tries to join a group they are blocked from joining.
350 $channel->error($cur, _('You have been blocked from that group by the admin.'));
355 $cur->joinGroup($group);
356 } catch (Exception $e) {
357 // TRANS: Message given having failed to add a user to a group.
358 // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
359 $channel->error($cur, sprintf(_('Could not join user %1$s to group %2$s.'),
360 $cur->nickname, $group->nickname));
364 // TRANS: Message given having added a user to a group.
365 // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
366 $channel->output($cur, sprintf(_('%1$s joined group %2$s.'),
372 class DropCommand extends Command
376 function __construct($user, $other)
378 parent::__construct($user);
379 $this->other = $other;
382 function handle($channel)
384 $group = $this->getGroup($this->other);
388 // TRANS: Error text shown when trying to leave a group that does not exist.
389 $channel->error($cur, _('No such group.'));
393 if (!$cur->isMember($group)) {
394 // TRANS: Error text shown when trying to leave an existing group the user is not a member of.
395 $channel->error($cur, _('You are not a member of that group.'));
400 $cur->leaveGroup($group);
401 } catch (Exception $e) {
402 // TRANS: Message given having failed to remove a user from a group.
403 // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
404 $channel->error($cur, sprintf(_('Could not remove user %1$s from group %2$s.'),
405 $cur->nickname, $group->nickname));
409 // TRANS: Message given having removed a user from a group.
410 // TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
411 $channel->output($cur, sprintf(_('%1$s left group %2$s.'),
417 class WhoisCommand extends Command
420 function __construct($user, $other)
422 parent::__construct($user);
423 $this->other = $other;
426 function handle($channel)
428 $recipient = $this->getProfile($this->other);
430 // TRANS: Whois output.
431 // TRANS: %1$s nickname of the queried user, %2$s is their profile URL.
432 $whois = sprintf(_m('WHOIS',"%1\$s (%2\$s)"), $recipient->nickname,
433 $recipient->profileurl);
434 if ($recipient->fullname) {
435 // TRANS: Whois output. %s is the full name of the queried user.
436 $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
438 if ($recipient->location) {
439 // TRANS: Whois output. %s is the location of the queried user.
440 $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
442 if ($recipient->homepage) {
443 // TRANS: Whois output. %s is the homepage of the queried user.
444 $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
446 if ($recipient->bio) {
447 // TRANS: Whois output. %s is the bio information of the queried user.
448 $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
450 $channel->output($this->user, $whois);
454 class MessageCommand extends Command
458 function __construct($user, $other, $text)
460 parent::__construct($user);
461 $this->other = $other;
465 function handle($channel)
468 $other = $this->getUser($this->other);
469 } catch (CommandException $e) {
471 $profile = $this->getProfile($this->other);
472 } catch (CommandException $f) {
475 // TRANS: Command exception text shown when trying to send a direct message to a remote user (a user not registered at the current server).
476 // TRANS: %s is a remote profile.
477 throw new CommandException(sprintf(_('%s is a remote profile; you can only send direct messages to users on the same server.'), $this->other));
480 $len = mb_strlen($this->text);
483 // TRANS: Command exception text shown when trying to send a direct message to another user without content.
484 $channel->error($this->user, _('No content!'));
488 $this->text = $this->user->shortenLinks($this->text);
490 if (Message::contentTooLong($this->text)) {
491 // XXX: i18n. Needs plural support.
492 // TRANS: Message given if content is too long. %1$sd is used for plural.
493 // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
494 $channel->error($this->user, sprintf(_m('Message too long - maximum is %1$d character, you sent %2$d.',
495 'Message too long - maximum is %1$d characters, you sent %2$d.',
496 Message::maxContent()),
497 Message::maxContent(), mb_strlen($this->text)));
502 // TRANS: Error text shown when trying to send a direct message to a user that does not exist.
503 $channel->error($this->user, _('No such user.'));
505 } else if (!$this->user->mutuallySubscribed($other)) {
506 // TRANS: Error text shown when trying to send a direct message to a user without a mutual subscription (each user must be subscribed to the other).
507 $channel->error($this->user, _('You can\'t send a message to this user.'));
509 } else if ($this->user->id == $other->id) {
510 // TRANS: Error text shown when trying to send a direct message to self.
511 $channel->error($this->user, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
514 $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
517 // TRANS: Message given have sent a direct message to another user.
518 // TRANS: %s is the name of the other user.
519 $channel->output($this->user, sprintf(_('Direct message to %s sent.'), $this->other));
521 // TRANS: Error text shown sending a direct message fails with an unknown reason.
522 $channel->error($this->user, _('Error sending direct message.'));
527 class RepeatCommand extends Command
530 function __construct($user, $other)
532 parent::__construct($user);
533 $this->other = $other;
536 function handle($channel)
538 $notice = $this->getNotice($this->other);
541 $repeat = $notice->repeat($this->user->id, $channel->source());
542 $recipient = $notice->getProfile();
544 // TRANS: Message given having repeated a notice from another user.
545 // TRANS: %s is the name of the user for which the notice was repeated.
546 $channel->output($this->user, sprintf(_('Notice from %s repeated.'), $recipient->nickname));
547 } catch (Exception $e) {
548 $channel->error($this->user, $e->getMessage());
553 class ReplyCommand extends Command
557 function __construct($user, $other, $text)
559 parent::__construct($user);
560 $this->other = $other;
564 function handle($channel)
566 $notice = $this->getNotice($this->other);
567 $recipient = $notice->getProfile();
569 $len = mb_strlen($this->text);
572 // TRANS: Command exception text shown when trying to reply to a notice without providing content for the reply.
573 $channel->error($this->user, _('No content!'));
577 $this->text = $this->user->shortenLinks($this->text);
579 if (Notice::contentTooLong($this->text)) {
580 // XXX: i18n. Needs plural support.
581 // TRANS: Message given if content of a notice for a reply is too long. %1$d is used for plural.
582 // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
583 $channel->error($this->user, sprintf(_m('Notice too long - maximum is %1$d character, you sent %2$d.',
584 'Notice too long - maximum is %1$d characters, you sent %2$d.',
585 Notice::maxContent()),
586 Notice::maxContent(), mb_strlen($this->text)));
590 $notice = Notice::saveNew($this->user->id, $this->text, $channel->source(),
591 array('reply_to' => $notice->id));
594 // TRANS: Text shown having sent a reply to a notice successfully.
595 // TRANS: %s is the nickname of the user of the notice the reply was sent to.
596 $channel->output($this->user, sprintf(_('Reply to %s sent.'), $recipient->nickname));
598 // TRANS: Error text shown when a reply to a notice fails with an unknown reason.
599 $channel->error($this->user, _('Error saving notice.'));
605 class GetCommand extends Command
609 function __construct($user, $other)
611 parent::__construct($user);
612 $this->other = $other;
615 function handle($channel)
617 $target = $this->getProfile($this->other);
619 $notice = $target->getCurrentNotice();
621 // TRANS: Error text shown when a last user notice is requested and it does not exist.
622 $channel->error($this->user, _('User has no last notice.'));
625 $notice_content = $notice->content;
627 $channel->output($this->user, $target->nickname . ": " . $notice_content);
631 class SubCommand extends Command
635 function __construct($user, $other)
637 parent::__construct($user);
638 $this->other = $other;
641 function handle($channel)
645 // TRANS: Error text shown when no username was provided when issuing a subscribe command.
646 $channel->error($this->user, _('Specify the name of the user to subscribe to.'));
650 $target = $this->getProfile($this->other);
652 $remote = Remote_profile::staticGet('id', $target->id);
654 // TRANS: Command exception text shown when trying to subscribe to an OMB profile using the subscribe command.
655 throw new CommandException(_("Can't subscribe to OMB profiles by command."));
659 Subscription::start($this->user->getProfile(),
661 // TRANS: Text shown after having subscribed to another user successfully.
662 // TRANS: %s is the name of the user the subscription was requested for.
663 $channel->output($this->user, sprintf(_('Subscribed to %s.'), $this->other));
664 } catch (Exception $e) {
665 $channel->error($this->user, $e->getMessage());
670 class UnsubCommand extends Command
674 function __construct($user, $other)
676 parent::__construct($user);
677 $this->other = $other;
680 function handle($channel)
683 // TRANS: Error text shown when no username was provided when issuing an unsubscribe command.
684 $channel->error($this->user, _('Specify the name of the user to unsubscribe from.'));
688 $target = $this->getProfile($this->other);
691 Subscription::cancel($this->user->getProfile(),
693 // TRANS: Text shown after having unsubscribed from another user successfully.
694 // TRANS: %s is the name of the user the unsubscription was requested for.
695 $channel->output($this->user, sprintf(_('Unsubscribed from %s.'), $this->other));
696 } catch (Exception $e) {
697 $channel->error($this->user, $e->getMessage());
702 class OffCommand extends Command
706 function __construct($user, $other=null)
708 parent::__construct($user);
709 $this->other = $other;
711 function handle($channel)
714 // TRANS: Error text shown when issuing the command "off" with a setting which has not yet been implemented.
715 $channel->error($this->user, _("Command not yet implemented."));
717 if ($channel->off($this->user)) {
718 // TRANS: Text shown when issuing the command "off" successfully.
719 $channel->output($this->user, _('Notification off.'));
721 // TRANS: Error text shown when the command "off" fails for an unknown reason.
722 $channel->error($this->user, _('Can\'t turn off notification.'));
728 class OnCommand extends Command
731 function __construct($user, $other=null)
733 parent::__construct($user);
734 $this->other = $other;
737 function handle($channel)
740 // TRANS: Error text shown when issuing the command "on" with a setting which has not yet been implemented.
741 $channel->error($this->user, _("Command not yet implemented."));
743 if ($channel->on($this->user)) {
744 // TRANS: Text shown when issuing the command "on" successfully.
745 $channel->output($this->user, _('Notification on.'));
747 // TRANS: Error text shown when the command "on" fails for an unknown reason.
748 $channel->error($this->user, _('Can\'t turn on notification.'));
754 class LoginCommand extends Command
756 function handle($channel)
758 $disabled = common_config('logincommand','disabled');
759 $disabled = isset($disabled) && $disabled;
761 // TRANS: Error text shown when issuing the login command while login is disabled.
762 $channel->error($this->user, _('Login command is disabled.'));
767 $login_token = Login_token::makeNew($this->user);
768 } catch (Exception $e) {
769 $channel->error($this->user, $e->getMessage());
772 $channel->output($this->user,
773 // TRANS: Text shown after issuing the login command successfully.
774 // TRANS: %s is a logon link..
775 sprintf(_('This link is useable only once and is valid for only 2 minutes: %s.'),
776 common_local_url('otp',
777 array('user_id' => $login_token->user_id, 'token' => $login_token->token))));
781 class LoseCommand extends Command
785 function __construct($user, $other)
787 parent::__construct($user);
788 $this->other = $other;
791 function execute($channel)
794 // TRANS: Error text shown when no username was provided when issuing the command.
795 $channel->error($this->user, _('Specify the name of the user to unsubscribe from.'));
799 $result = Subscription::cancel($this->getProfile($this->other), $this->user->getProfile());
802 // TRANS: Text shown after issuing the lose command successfully (stop another user from following the current user).
803 // TRANS: %s is the name of the user the unsubscription was requested for.
804 $channel->output($this->user, sprintf(_('Unsubscribed %s.'), $this->other));
806 $channel->error($this->user, $result);
811 class SubscriptionsCommand extends Command
813 function handle($channel)
815 $profile = $this->user->getSubscriptions(0);
817 while ($profile->fetch()) {
818 $nicknames[]=$profile->nickname;
820 if(count($nicknames)==0){
821 // TRANS: Text shown after requesting other users a user is subscribed to without having any subscriptions.
822 $out=_('You are not subscribed to anyone.');
824 // TRANS: Text shown after requesting other users a user is subscribed to.
825 // TRANS: This message supports plural forms. This message is followed by a
826 // TRANS: hard coded space and a comma separated list of subscribed users.
827 $out = _m('You are subscribed to this person:',
828 'You are subscribed to these people:',
831 $out .= implode(', ',$nicknames);
833 $channel->output($this->user,$out);
837 class SubscribersCommand extends Command
839 function handle($channel)
841 $profile = $this->user->getSubscribers();
843 while ($profile->fetch()) {
844 $nicknames[]=$profile->nickname;
846 if(count($nicknames)==0){
847 // TRANS: Text shown after requesting other users that are subscribed to a user
848 // TRANS: (followers) without having any subscribers.
849 $out=_('No one is subscribed to you.');
851 // TRANS: Text shown after requesting other users that are subscribed to a user (followers).
852 // TRANS: This message supports plural forms. This message is followed by a
853 // TRANS: hard coded space and a comma separated list of subscribing users.
854 $out = _m('This person is subscribed to you:',
855 'These people are subscribed to you:',
858 $out .= implode(', ',$nicknames);
860 $channel->output($this->user,$out);
864 class GroupsCommand extends Command
866 function handle($channel)
868 $group = $this->user->getGroups();
870 while ($group->fetch()) {
871 $groups[]=$group->nickname;
873 if(count($groups)==0){
874 // TRANS: Text shown after requesting groups a user is subscribed to without having
875 // TRANS: any group subscriptions.
876 $out=_('You are not a member of any groups.');
878 // TRANS: Text shown after requesting groups a user is subscribed to.
879 // TRANS: This message supports plural forms. This message is followed by a
880 // TRANS: hard coded space and a comma separated list of subscribed groups.
881 $out = _m('You are a member of this group:',
882 'You are a member of these groups:',
884 $out.=implode(', ',$groups);
886 $channel->output($this->user,$out);
890 class HelpCommand extends Command
892 function handle($channel)
894 // TRANS: Header line of help text for commands.
895 $out = array(_m('COMMANDHELP', "Commands:"));
896 $commands = array(// TRANS: Help message for IM/SMS command "on"
897 "on" => _m('COMMANDHELP', "turn on notifications"),
898 // TRANS: Help message for IM/SMS command "off"
899 "off" => _m('COMMANDHELP', "turn off notifications"),
900 // TRANS: Help message for IM/SMS command "help"
901 "help" => _m('COMMANDHELP', "show this help"),
902 // TRANS: Help message for IM/SMS command "follow <nickname>"
903 "follow <nickname>" => _m('COMMANDHELP', "subscribe to user"),
904 // TRANS: Help message for IM/SMS command "groups"
905 "groups" => _m('COMMANDHELP', "lists the groups you have joined"),
906 // TRANS: Help message for IM/SMS command "subscriptions"
907 "subscriptions" => _m('COMMANDHELP', "list the people you follow"),
908 // TRANS: Help message for IM/SMS command "subscribers"
909 "subscribers" => _m('COMMANDHELP', "list the people that follow you"),
910 // TRANS: Help message for IM/SMS command "leave <nickname>"
911 "leave <nickname>" => _m('COMMANDHELP', "unsubscribe from user"),
912 // TRANS: Help message for IM/SMS command "d <nickname> <text>"
913 "d <nickname> <text>" => _m('COMMANDHELP', "direct message to user"),
914 // TRANS: Help message for IM/SMS command "get <nickname>"
915 "get <nickname>" => _m('COMMANDHELP', "get last notice from user"),
916 // TRANS: Help message for IM/SMS command "whois <nickname>"
917 "whois <nickname>" => _m('COMMANDHELP', "get profile info on user"),
918 // TRANS: Help message for IM/SMS command "lose <nickname>"
919 "lose <nickname>" => _m('COMMANDHELP', "force user to stop following you"),
920 // TRANS: Help message for IM/SMS command "fav <nickname>"
921 "fav <nickname>" => _m('COMMANDHELP', "add user's last notice as a 'fave'"),
922 // TRANS: Help message for IM/SMS command "fav #<notice_id>"
923 "fav #<notice_id>" => _m('COMMANDHELP', "add notice with the given id as a 'fave'"),
924 // TRANS: Help message for IM/SMS command "repeat #<notice_id>"
925 "repeat #<notice_id>" => _m('COMMANDHELP', "repeat a notice with a given id"),
926 // TRANS: Help message for IM/SMS command "repeat <nickname>"
927 "repeat <nickname>" => _m('COMMANDHELP', "repeat the last notice from user"),
928 // TRANS: Help message for IM/SMS command "reply #<notice_id>"
929 "reply #<notice_id>" => _m('COMMANDHELP', "reply to notice with a given id"),
930 // TRANS: Help message for IM/SMS command "reply <nickname>"
931 "reply <nickname>" => _m('COMMANDHELP', "reply to the last notice from user"),
932 // TRANS: Help message for IM/SMS command "join <group>"
933 "join <group>" => _m('COMMANDHELP', "join group"),
934 // TRANS: Help message for IM/SMS command "login"
935 "login" => _m('COMMANDHELP', "Get a link to login to the web interface"),
936 // TRANS: Help message for IM/SMS command "drop <group>"
937 "drop <group>" => _m('COMMANDHELP', "leave group"),
938 // TRANS: Help message for IM/SMS command "stats"
939 "stats" => _m('COMMANDHELP', "get your stats"),
940 // TRANS: Help message for IM/SMS command "stop"
941 "stop" => _m('COMMANDHELP', "same as 'off'"),
942 // TRANS: Help message for IM/SMS command "quit"
943 "quit" => _m('COMMANDHELP', "same as 'off'"),
944 // TRANS: Help message for IM/SMS command "sub <nickname>"
945 "sub <nickname>" => _m('COMMANDHELP', "same as 'follow'"),
946 // TRANS: Help message for IM/SMS command "unsub <nickname>"
947 "unsub <nickname>" => _m('COMMANDHELP', "same as 'leave'"),
948 // TRANS: Help message for IM/SMS command "last <nickname>"
949 "last <nickname>" => _m('COMMANDHELP', "same as 'get'"),
950 // TRANS: Help message for IM/SMS command "on <nickname>"
951 "on <nickname>" => _m('COMMANDHELP', "not yet implemented."),
952 // TRANS: Help message for IM/SMS command "off <nickname>"
953 "off <nickname>" => _m('COMMANDHELP', "not yet implemented."),
954 // TRANS: Help message for IM/SMS command "nudge <nickname>"
955 "nudge <nickname>" => _m('COMMANDHELP', "remind a user to update."),
956 // TRANS: Help message for IM/SMS command "invite <phone number>"
957 "invite <phone number>" => _m('COMMANDHELP', "not yet implemented."),
958 // TRANS: Help message for IM/SMS command "track <word>"
959 "track <word>" => _m('COMMANDHELP', "not yet implemented."),
960 // TRANS: Help message for IM/SMS command "untrack <word>"
961 "untrack <word>" => _m('COMMANDHELP', "not yet implemented."),
962 // TRANS: Help message for IM/SMS command "track off"
963 "track off" => _m('COMMANDHELP', "not yet implemented."),
964 // TRANS: Help message for IM/SMS command "untrack all"
965 "untrack all" => _m('COMMANDHELP', "not yet implemented."),
966 // TRANS: Help message for IM/SMS command "tracks"
967 "tracks" => _m('COMMANDHELP', "not yet implemented."),
968 // TRANS: Help message for IM/SMS command "tracking"
969 "tracking" => _m('COMMANDHELP', "not yet implemented."));
971 // Give plugins a chance to add or override...
972 Event::handle('HelpCommandMessages', array($this, &$commands));
973 foreach ($commands as $command => $help) {
974 $out[] = "$command - $help";
976 $channel->output($this->user, implode("\n", $out));