summaryrefslogtreecommitdiffstats
path: root/src/Client/CommandParser.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-02-13 00:00:05 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-02-13 00:00:05 +0100
commit04363ca342914ba75e693edb876cbe535839fa79 (patch)
treed1309d7b0f6288a8250e972e5cab2546f2a77609 /src/Client/CommandParser.cpp
parent2ab1fbd763ad8692ea3ca29705a4fe821ccb1309 (diff)
downloadmad-04363ca342914ba75e693edb876cbe535839fa79.tar
mad-04363ca342914ba75e693edb876cbe535839fa79.zip
Einfache Abfrage der Benutzerdatenbank implementiert
Diffstat (limited to 'src/Client/CommandParser.cpp')
-rw-r--r--src/Client/CommandParser.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index efc9c4b..304a2ff 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -28,6 +28,7 @@
#include <Common/Requests/FSInfoRequest.h>
#include <Common/Requests/DisconnectRequest.h>
#include <Common/Requests/StatusRequest.h>
+#include <Common/Requests/UserListRequest.h>
#include <Common/Tokenizer.h>
#include <Net/Packets/HostListPacket.h>
#include <Net/Packets/HostStatusPacket.h>
@@ -40,13 +41,14 @@ namespace Mad {
namespace Client {
const CommandParser::Command CommandParser::commands[] = {
- {{"fsinfo", 0}, "fsinfo [host]", "Displays file system usage information", "Displays file system usage information of a host or the server (if no host is given).", &CommandParser::fsinfoCommand},
- {{"help", "?", 0}, "help [command]", "Displays usage information about commands", "Displays usage information about a command. If no command is given, a list of all available commands is displayed.", &CommandParser::helpCommand},
- {{"list_hosts", "hosts", 0}, "list_hosts [-a]", "Lists the currently active hosts", "Lists the currently active hosts.\n\n -a\tAlso list inactive hosts", &CommandParser::listHostsCommand},
- {{"reboot", 0}, "reboot *|host...", "Reboots host", "Reboots hosts. * will reboot all hosts.", &CommandParser::rebootCommand},
- {{"shutdown", "halt", 0}, "shutdown *|host...", "Shuts hosts down", "Shuts hosts down. * will shut down all hosts.", &CommandParser::shutdownCommand},
- {{"status", "st", 0}, "status [host]", "Displays status information", "Displays host status information. If no host is given, server status information is displayed.", &CommandParser::statusCommand},
- {{"exit", "quit", 0}, "exit", "Closes the connection and quits the client", "Closes the connection and quits the client.", &CommandParser::exitCommand},
+ {{"fsinfo", 0}, "fsinfo [host]", "Display file system usage information", "Display file system usage information of a host or the server (if no host is given).", &CommandParser::fsinfoCommand},
+ {{"help", "?", 0}, "help [command]", "Display usage information about commands", "Display usage information about a command. If no command is given, display a list of all available commands.", &CommandParser::helpCommand},
+ {{"list_hosts", "hosts", 0}, "list_hosts [-a]", "List the currently active hosts", "List the currently active hosts.\n\n -a\tAlso list inactive hosts", &CommandParser::listHostsCommand},
+ {{"reboot", 0}, "reboot *|host...", "Reboot host", "Reboot hosts. * will reboot all hosts.", &CommandParser::rebootCommand},
+ {{"shutdown", "halt", 0}, "shutdown *|host...", "Shut hosts down", "Shut hosts down. * will shut down all hosts.", &CommandParser::shutdownCommand},
+ {{"status", "st", 0}, "status [host]", "Display status information", "Display host status information. If no host is given, display server status information.", &CommandParser::statusCommand},
+ {{"list_users", "users", 0}, "list_users", "Show the user account database", "Show the user account database.", &CommandParser::listUsersCommand},
+ {{"exit", "quit", 0}, "exit", "Close the connection and quit the client", "Closes the connection and quits the client.", &CommandParser::exitCommand},
{{0}, 0, 0, 0, 0}
};
@@ -253,6 +255,12 @@ void CommandParser::statusCommand(const std::vector<std::string> &args) {
++CommandManager::get()->activeRequests;
}
+void CommandParser::listUsersCommand(const std::vector<std::string>&) {
+ ++CommandManager::get()->activeRequests;
+
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::UserListRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::userListRequestFinished))));
+}
+
void CommandParser::exitCommand(const std::vector<std::string>&) {
++CommandManager::get()->activeRequests;