handleOptions method

void handleOptions(
  1. String argument,
  2. FtpSession session
)

Implementation

void handleOptions(String argument, FtpSession session) {
  if (argument.isEmpty) {
    session.sendResponse('501 Syntax error in parameters');
    return;
  }
  var args = argument.split(" ");
  var option = args[0].toUpperCase();
  switch (option) {
    case "UTF8":
      if (args.length < 2) {
        session.sendResponse('501 Syntax error in parameters');
        return;
      }
      var mode = args[1].toUpperCase() == "ON";
      session.sendResponse("200 UTF8 mode ${mode ? 'enable' : 'disable'}");
      break;
    default:
      session.sendResponse('502 Command not implemented');
      break;
  }
}