예제 #1
0
 /**
  * Called when the input was a line of text that was not a command. This normally means it is sent
  * to the server/channel/user as-is, with no further processing.
  *
  * @param origin The window in which the command was typed
  * @param line The line input by the user
  */
 @Override
 protected void handleNonCommand(final InputWindow origin, final String line) {
   if (origin == null) {
     Logger.userError(ErrorLevel.MEDIUM, "Invalid global command: " + line);
   } else {
     origin.addLine("commandError", "Invalid global command: " + line);
   }
 }
예제 #2
0
파일: Me.java 프로젝트: wudigithub1/client
  /** {@inheritDoc} */
  @Override
  public ValidationResponse validateArguments(
      final InputWindow origin, final CommandArguments arguments) {
    if (origin.getContainer().getServer() == null
        || origin.getContainer().getServer().getParser() == null) {
      return new ValidationResponse();
    }

    final int length = 2 + arguments.getArgumentsAsString().length();

    if (origin
            .getContainer()
            .getServer()
            .getParser()
            .getMaxLength("PRIVMSG", origin.getContainer().toString())
        <= length) {
      return new ValidationResponse("Too long");
    } else {
      return new ValidationResponse();
    }
  }
예제 #3
0
 /** {@inheritDoc} */
 @Override
 public int getLineCount(final InputWindow origin, final CommandArguments arguments) {
   if (arguments.getArguments().length >= 2) {
     final String target = arguments.getArguments()[0];
     return origin
         .getContainer()
         .getServer()
         .getNumLines("PRIVMSG " + target + " :" + arguments.getArgumentsAsString(1));
   } else {
     return 1;
   }
 }
예제 #4
0
  /** {@inheritDoc} */
  @Override
  public void run() {
    CommandParser parser;
    if (origin == null) {
      parser = GlobalCommandParser.getGlobalCommandParser();
    } else {
      parser = origin.getCommandParser();
    }

    parser.parseCommand(origin, command);

    if (--repetitions <= 0) {
      timer.cancel();
    }
  }