From 35ab037e7e6ac08e214b053de8ed87e3f35586fc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Feb 2009 22:39:33 +0100 Subject: Einigen unnoetigen Code entfernt --- src/Client/CommandParser.cpp | 63 +++----------------------------------------- 1 file changed, 3 insertions(+), 60 deletions(-) (limited to 'src/Client/CommandParser.cpp') diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 6665ea2..ff93aec 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -242,9 +242,9 @@ void CommandParser::shutdownCommand(const std::vector &args) { void CommandParser::statusCommand(const std::vector &args) { if(args.size() == 1) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished)))); else if(args.size() == 2) - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished)))); else { Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str()); printUsage("status"); @@ -257,7 +257,7 @@ void CommandParser::statusCommand(const std::vector &args) { void CommandParser::listUsersCommand(const std::vector&) { ++CommandManager::get()->activeRequests; - Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Common::Requests::UserListRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished)))); + Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Common::Requests::UserListRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished)))); } void CommandParser::exitCommand(const std::vector&) { @@ -266,63 +266,6 @@ void CommandParser::exitCommand(const std::vector&) { Common::RequestManager::get()->sendRequest(connection, std::auto_ptr(new Common::Requests::DisconnectRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::disconnectRequestFinished)))); } -bool CommandParser::split(const std::string &str, std::vector &ret) { - std::string temp; - bool quoteSingle = false, quoteDouble = false, escape = false; - - size_t beg = 0; - - for(size_t cur = 0; cur < str.length(); ++cur) { - if(!escape) { - if(str[cur] == ' ' && !quoteSingle && !quoteDouble) { - if(cur == beg && temp.empty()) { - ++beg; - } - else { - temp += str.substr(beg, cur-beg); - ret.push_back(temp); - temp.clear(); - beg = cur+1; - } - - continue; - } - - if(str[cur] == '"' && !quoteSingle) { - temp += str.substr(beg, cur-beg); - beg = cur+1; - - quoteDouble = !quoteDouble; - continue; - } - if(str[cur] == '\'' && !quoteDouble) { - temp += str.substr(beg, cur-beg); - beg = cur+1; - - quoteSingle = !quoteSingle; - continue; - } - - if(str[cur] == '\\') { - escape = true; - continue; - } - } - - if(escape && ((!quoteSingle && !quoteDouble) || (quoteSingle && str[cur] == '\'') || (quoteDouble && (str[cur] == '"' || str[cur] == '\\')))) { - temp += str.substr(beg, cur-beg-1); - beg = cur; - } - - escape = false; - } - - temp += str.substr(beg, std::string::npos); - ret.push_back(temp); - - return true; -} - bool CommandParser::parse(const std::string &cmd) { std::vector splitCmd; -- cgit v1.2.3