void craft_message(SOCKET *sock, SOCKADDR_IN *sout) { int i; int j; for (i = 1; i * 2 < 0xFF; i++) for (j = 1; j * 2 < 0xFF; j++) send_chat_message(sock, sout, i, j * 2); }
void chat_handler::do_speak(const std::string& message, bool allies_only) { if (message == "" || message == "/") { return; } bool is_command = (message[0] == '/'); bool quoted_command = (is_command && message[1] == ' '); if (!is_command) { send_chat_message(message, allies_only); return; } else if (quoted_command) { send_chat_message(std::string(message.begin() + 2, message.end()), allies_only); return; } std::string cmd(message.begin() + 1, message.end()); chat_command_handler cch(*this, allies_only); cch.dispatch(cmd); }
void LocalClient::parse_user_input(const std::string s) { if (s.length() <= 0) { return; } if (s[0] != '/') { // - we're dealing with a chat message send_chat_message(s); } else { std::vector<std::string> input = split(s, ' '); if (input.size() <= 0) { return; } auto it = funcs.find(input[0]); if (it != funcs.end()) { it->second(input); } else { PRINT("%s: command not found. See /help for a list of available commands.\n", input[0].c_str()); } } }