Update changes.
This commit is contained in:
1 parent
86bd62221f
commit
608f8a2b0c
249 files changed
+1562
-1734
No files matched your search
+12
-12
@@ -4,41 +4,41 @@
|
||||
namespace core {
|
||||
|
||||
CommandList::CommandList(std::string delimiter) : delimiter(delimiter) {}
|
||||
|
||||
|
||||
void CommandList::add(Command &command, std::string name) {
|
||||
command.setName(name);
|
||||
commands.push_back(&command);
|
||||
}
|
||||
|
||||
|
||||
void CommandList::remove(Command &command) {}
|
||||
|
||||
|
||||
bool CommandList::processRequest(coreutils::ZString &request, TCPSession &session) {
|
||||
if(session.grab != NULL)
|
||||
return session.grab->processCommand(request, session);
|
||||
return session.grab->processCommand(request, session);
|
||||
else {
|
||||
request.split(delimiter);
|
||||
for(auto *command : commands)
|
||||
if(command->check(request))
|
||||
return command->processCommand(request, session);
|
||||
for(auto *command : commands)
|
||||
if(command->check(request))
|
||||
return command->processCommand(request, session);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CommandList::grabInput(TCPSession &session, Command &command) {
|
||||
session.grab = &command;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CommandList::clearGrab(TCPSession &session) {
|
||||
session.grab = NULL;
|
||||
}
|
||||
|
||||
|
||||
int CommandList::processCommand(coreutils::ZString &request, TCPSession &session) {
|
||||
for(Command *command : commands)
|
||||
session.out << command->getName() << std::endl;
|
||||
session.out << command->getName() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user