diff options
Diffstat (limited to 'src/Client')
-rw-r--r-- | src/Client/CommandParser.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 3f1850c..a271860 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -213,19 +213,26 @@ void CommandParser::exitCommand(const std::vector<std::string> &/*args*/) { } bool CommandParser::parse(const std::string &cmd) { - std::vector<std::string> splitCmd; + std::vector<Core::UnicodeString> splitCmd; - Core::Tokenizer::tokenize(cmd, splitCmd); + Core::Tokenizer::tokenize(cmd.c_str(), splitCmd); if(splitCmd.empty()) return true; - const Command* command = findCommand(splitCmd[0]); + const Command* command = findCommand(splitCmd[0].extract()); - if(command) - command->function(this, splitCmd); - else - std::cerr << "Unknown command '" << splitCmd[0] << "'." << std::endl; + if(command) { + std::vector<std::string> strings; + + for(std::vector<Core::UnicodeString>::iterator it = splitCmd.begin(); it != splitCmd.end(); ++it) + strings.push_back(it->extract()); + + command->function(this, strings); + } + else { + std::cerr << "Unknown command '" << splitCmd[0].extract() << "'." << std::endl; + } return true; } |