Example #1
0
  /** {@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();
    }
  }
Example #2
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;
   }
 }