diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-02-13 00:00:05 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-02-13 00:00:05 +0100 |
commit | 04363ca342914ba75e693edb876cbe535839fa79 (patch) | |
tree | d1309d7b0f6288a8250e972e5cab2546f2a77609 /src/Client/CommandManager.cpp | |
parent | 2ab1fbd763ad8692ea3ca29705a4fe821ccb1309 (diff) | |
download | mad-04363ca342914ba75e693edb876cbe535839fa79.tar mad-04363ca342914ba75e693edb876cbe535839fa79.zip |
Einfache Abfrage der Benutzerdatenbank implementiert
Diffstat (limited to 'src/Client/CommandManager.cpp')
-rw-r--r-- | src/Client/CommandManager.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Client/CommandManager.cpp b/src/Client/CommandManager.cpp index 4b24782..aacf939 100644 --- a/src/Client/CommandManager.cpp +++ b/src/Client/CommandManager.cpp @@ -23,6 +23,7 @@ #include <Net/Packets/FSInfoPacket.h> #include <Net/Packets/HostListPacket.h> #include <Net/Packets/HostStatusPacket.h> +#include <Net/Packets/UserListPacket.h> #include <cmath> #include <iostream> @@ -205,5 +206,30 @@ void CommandManager::statusRequestFinished(const Common::Request<Net::Packets::H requestFinished(); } +void CommandManager::userListRequestFinished(const Common::Request<Net::Packets::UserListPacket> &request) { + try { + const Net::Packets::UserListPacket &packet = request.getResult(); + + const std::vector<Common::UserInfo> &users = packet.getUserInfo(); + + if(users.empty()) { + std::cout << "User list is empty." << std::endl; + } + else { + std::cout << "Found " << packet.getUserInfo().size() << " users:" << std::endl; + + for(std::vector<Common::UserInfo>::const_iterator user = users.begin(); user != users.end(); ++user) + std::cout << " " << user->getUid() << ", " << user->getGid() << ", " << user->getUsername() << ", " << user->getFullName() << std::endl; + } + + std::cout << std::endl; + } + catch(Common::Exception &exception) { + Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.", exception.strerror().c_str()); + } + + requestFinished(); +} + } } |