summaryrefslogtreecommitdiffstats
path: root/src/Client/CommandManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/CommandManager.cpp')
-rw-r--r--src/Client/CommandManager.cpp26
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();
+}
+
}
}