Ejemplo n.º 1
0
// Processes the input string to decide what type of command it is.
bool ProcessInput(std::string input) {
  std::vector<std::string> inputs = SplitString(input);

  if (inputs[0] == "/exit") {
    SendLogout();
    cooked_mode();
    return false;
  } else if (inputs[0] == "/list") {
    SendList();
  } else if (inputs[0] == "/join" && inputs.size() > 1) {
    SendJoin(inputs[1]);
  } else if (inputs[0] == "/leave" && inputs.size() > 1) {
    SendLeave(inputs[1]);
  } else if (inputs[0] == "/who" && inputs.size() > 1) {
    SendWho(inputs[1]);
  } else if (inputs[0] == "/switch" && inputs.size() > 1) {
    SwitchChannel(inputs[1]);
  } else {
    std::cout << "*Unknown command" << std::endl;
  }

  PrintPrompt();
  return true;
}
Ejemplo n.º 2
0
void LogoutCommand::RunImpl()
{
	SendLogout();
}