Exemple #1
0
 /**
  * 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)
  * @param User    $user    User sending the message
  * @param Command &$result The resulting command object to be run.
  *
  * @return boolean hook value
  */
 public function onStartInterpretCommand($cmd, $arg, $user, &$result)
 {
     if ($result === false && in_array($cmd, array('repeat', 'rp', 'rt', 'rd'))) {
         if (empty($arg)) {
             $result = null;
         } else {
             list($other, $extra) = CommandInterpreter::split_arg($arg);
             if (!empty($extra)) {
                 $result = null;
             } else {
                 $result = new RepeatCommand($user, $other);
             }
         }
         return false;
     }
     return true;
 }
 /**
  * EndInterpretCommand for FavoritePlugin will handle the 'fav' command
  * using the class FavCommand.
  *
  * @param string  $cmd     Command being run
  * @param string  $arg     Rest of the message (including address)
  * @param User    $user    User sending the message
  * @param Command &$result The resulting command object to be run.
  *
  * @return boolean hook value
  */
 public function onStartInterpretCommand($cmd, $arg, $user, &$result)
 {
     if ($result === false && $cmd == 'fav') {
         if (empty($arg)) {
             $result = null;
         } else {
             list($other, $extra) = CommandInterpreter::split_arg($arg);
             if (!empty($extra)) {
                 $result = null;
             } else {
                 $result = new FavCommand($user, $other);
             }
         }
         return false;
     }
     return true;
 }
 /**
  * EndInterpretCommand will handle the 'd' and 'dm' commands.
  *
  * @param string  $cmd     Command being run
  * @param string  $arg     Rest of the message (including address)
  * @param User    $user    User sending the message
  * @param Command &$result The resulting command object to be run.
  *
  * @return boolean hook value
  */
 public function onStartInterpretCommand($cmd, $arg, $user, &$result)
 {
     $dm_cmds = array('d', 'dm');
     if ($result === false && in_array($cmd, $dm_cmds)) {
         if (!empty($arg)) {
             list($other, $extra) = CommandInterpreter::split_arg($arg);
             if (!empty($extra)) {
                 $result = new MessageCommand($user, $other, $extra);
             }
         }
         return false;
     }
     return true;
 }