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.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/Client/CommandManager.cpp b/src/Client/CommandManager.cpp
index d98b041..59de7c4 100644
--- a/src/Client/CommandManager.cpp
+++ b/src/Client/CommandManager.cpp
@@ -21,7 +21,6 @@
#include <Common/HostInfo.h>
#include <Common/Logger.h>
#include <Common/XmlRequest.h>
-#include <Net/Packets/FSInfoPacket.h>
#include <cmath>
#include <iostream>
@@ -34,19 +33,19 @@ namespace Client {
CommandManager CommandManager::commandManager;
-void CommandManager::printFSInfo(const Net::Packets::FSInfoPacket &packet) {
+void CommandManager::printFSInfo(const Common::XmlPacket &packet) {
const std::string units[] = {
"kB", "MB", "GB", "TB", ""
};
- const std::vector<Common::SystemBackend::FSInfo>& fsList = packet.getFSInfo();
+ for(size_t i = 0; i < packet["filesystems"].getSize(); ++i) {
+ const Common::XmlPacket::Entry &fs = packet["filesystems"][i];
- for(std::vector<Common::SystemBackend::FSInfo>::const_iterator fs = fsList.begin(); fs != fsList.end(); ++fs) {
unsigned usedUnit = 0, totalUnit = 0;
- float used = fs->used;
- float total = fs->total;
- float available = fs->available;
+ float used = fs["usedSize"];
+ float total = fs["totalSize"];
+ float available = fs["availableSize"];
while(used >= 1024 && !units[usedUnit+1].empty()) {
++usedUnit;
@@ -59,7 +58,11 @@ void CommandManager::printFSInfo(const Net::Packets::FSInfoPacket &packet) {
total /= 1024;
}
- std::string nameString = fs->mountedOn + " (" + fs->fsName + ")";
+
+ std::string name = fs["name"];
+ std::string mountedOn = fs["mountedOn"];
+
+ std::string nameString = mountedOn + " (" + name + ")";
if(nameString.length() < 32) {
nameString.resize(32, ' ');
@@ -133,7 +136,7 @@ void CommandManager::printHostStatus(const Common::XmlPacket &packet) {
}
-void CommandManager::daemonCommandRequestFinished(const Common::Request<> &request) {
+void CommandManager::daemonCommandRequestFinished(const Common::XmlRequest &request) {
try {
request.getResult();
}
@@ -144,9 +147,9 @@ void CommandManager::daemonCommandRequestFinished(const Common::Request<> &reque
requestFinished();
}
-void CommandManager::daemonFSInfoRequestFinished(const Common::Request<Net::Packets::FSInfoPacket> &request) {
+void CommandManager::daemonFSInfoRequestFinished(const Common::XmlRequest &request) {
try {
- const Net::Packets::FSInfoPacket &packet = request.getResult();
+ const Common::XmlPacket &packet = request.getResult();
std::cout << "Host file system usage:" << std::endl;
printFSInfo(packet);
}
@@ -170,7 +173,7 @@ void CommandManager::daemonStatusRequestFinished(const Common::XmlRequest &reque
requestFinished();
}
-void CommandManager::disconnectRequestFinished(const Common::Request<> &request) {
+void CommandManager::disconnectRequestFinished(const Common::XmlRequest &request) {
try {
request.getResult();
disconnect = true;
@@ -182,9 +185,9 @@ void CommandManager::disconnectRequestFinished(const Common::Request<> &request)
requestFinished();
}
-void CommandManager::fsInfoRequestFinished(const Common::Request<Net::Packets::FSInfoPacket> &request) {
+void CommandManager::fsInfoRequestFinished(const Common::XmlRequest &request) {
try {
- const Net::Packets::FSInfoPacket &packet = request.getResult();
+ const Common::XmlPacket &packet = request.getResult();
std::cout << "Server file system usage:" << std::endl;
printFSInfo(packet);
}