- } else {
- return new OffCommand($user);
- }
- case 'stop':
- case 'quit':
- if ($arg) {
- return null;
- } else {
- return new OffCommand($user);
- }
- case 'join':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new JoinCommand($user, $other);
- }
- case 'drop':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new DropCommand($user, $other);
- }
- case 'follow':
- case 'sub':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new SubCommand($user, $other);
- }
- case 'leave':
- case 'unsub':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new UnsubCommand($user, $other);
- }
- case 'get':
- case 'last':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new GetCommand($user, $other);
- }
- case 'd':
- case 'dm':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if (!$extra) {
- return null;
- } else {
- return new MessageCommand($user, $other, $extra);
- }
- case 'r':
- case 'reply':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if (!$extra) {
- return null;
- } else {
- return new ReplyCommand($user, $other, $extra);
- }
- case 'repeat':
- case 'rp':
- case 'rt':
- case 'rd':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new RepeatCommand($user, $other);
- }
- case 'whois':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new WhoisCommand($user, $other);
- }
- case 'fav':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new FavCommand($user, $other);
- }
- case 'nudge':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new NudgeCommand($user, $other);
- }
- case 'stats':
- if ($arg) {
- return null;
- }
- return new StatsCommand($user);
- case 'invite':
- if (!$arg) {
- return null;
- }
- list($other, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else {
- return new InviteCommand($user, $other);
- }
- case 'track':
- if (!$arg) {
- return null;
- }
- list($word, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else if ($word == 'off') {
- return new TrackOffCommand($user);
- } else {
- return new TrackCommand($user, $word);
- }
- case 'untrack':
- if (!$arg) {
- return null;
- }
- list($word, $extra) = $this->split_arg($arg);
- if ($extra) {
- return null;
- } else if ($word == 'all') {
- return new TrackOffCommand($user);
- } else {
- return new UntrackCommand($user, $word);
- }
- case 'tracks':
- case 'tracking':
- if ($arg) {
- return null;
+ break;
+ case 'r':
+ case 'reply':
+ if (!$arg) {
+ $result = null;
+ }
+ list($other, $extra) = self::split_arg($arg);
+ if (!$extra) {
+ $result = null;
+ } else {
+ $result = new ReplyCommand($user, $other, $extra);
+ }
+ break;
+ case 'repeat':
+ case 'rp':
+ case 'rt':
+ case 'rd':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($other, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else {
+ $result = new RepeatCommand($user, $other);
+ }
+ }
+ break;
+ case 'whois':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($other, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else {
+ $result = new WhoisCommand($user, $other);
+ }
+ }
+ break;
+ case 'nudge':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($other, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else {
+ $result = new NudgeCommand($user, $other);
+ }
+ }
+ break;
+ case 'stats':
+ if ($arg) {
+ $result = null;
+ } else {
+ $result = new StatsCommand($user);
+ }
+ break;
+ case 'invite':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($other, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else {
+ $result = new InviteCommand($user, $other);
+ }
+ }
+ break;
+ case 'list':
+ case 'tag':
+ if (!$arg) {
+ $result = null;
+ break;
+ }
+ list($other, $tags) = self::split_arg($arg);
+ if (!$tags) {
+ $result = null;
+ } else {
+ $result = new TagCommand($user, $other, $tags);
+ }
+ break;
+ case 'unlist':
+ case 'untag':
+ if (!$arg) {
+ $result = null;
+ break;
+ }
+ list($other, $tags) = self::split_arg($arg);
+ if (!$tags) {
+ $result = null;
+ } else {
+ $result = new UntagCommand($user, $other, $tags);
+ }
+ break;
+ case 'track':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($word, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else if ($word == 'off') {
+ $result = new TrackOffCommand($user);
+ } else {
+ $result = new TrackCommand($user, $word);
+ }
+ }
+ break;
+ case 'untrack':
+ if (!$arg) {
+ $result = null;
+ } else {
+ list($word, $extra) = self::split_arg($arg);
+ if ($extra) {
+ $result = null;
+ } else if ($word == 'all') {
+ $result = new TrackOffCommand($user);
+ } else {
+ $result = new UntrackCommand($user, $word);
+ }
+ }
+ break;
+ case 'tracks':
+ case 'tracking':
+ if ($arg) {
+ $result = null;
+ } else {
+ $result = new TrackingCommand($user);
+ }
+ break;
+ default:
+ $result = false;