diff options
Diffstat (limited to 'client/Config.cpp')
-rw-r--r-- | client/Config.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/client/Config.cpp b/client/Config.cpp index 429d615..7e617a3 100644 --- a/client/Config.cpp +++ b/client/Config.cpp @@ -3,7 +3,9 @@ #include <fstream> #include <sstream> #include <stdlib.h> +#include <QtCore> #include "Config.h" +#include "SslClient.h" using namespace std; @@ -16,8 +18,10 @@ Config *Config::CurrentConfig() return self; } -Config::Config(): StaticProxySpeedLow(50), configValid(0) +Config::Config(): QObject(), StaticProxySpeedLow(50) { + configValid = false; + Logger::Info("Parsing config.cfg to determine initial configuration\n"); ifstream configFile("config.cfg", std::ios::in); if (!configFile) @@ -86,6 +90,18 @@ Config::Config(): StaticProxySpeedLow(50), configValid(0) Logger::Warn("Unrecognized config option: %s\n", key.c_str()); } } + + configUpdateTimer = new QTimer; + configUpdateTimer->setInterval(updateInterval * 1000); + connect(configUpdateTimer, SIGNAL(timeout()), + this, SLOT(updateConfig())); + + client = new SslClient(servers[0].host); + /* + connect(client, SIGNAL(ReplyRecieved(SslClient::RequestType&, QByteArray&)), + this, SLOT(gotServerReply(SslClient::RequestType&, QByteArray&))); + */ + client->SendRequest(SslClient::Config); } void Config::AcquireConfig() @@ -275,6 +291,21 @@ int Config::ReadStaticProxy() return 0; } +void Config::updateConfig() +{ + Logger::Trace("Going to update entire configuration\n"); + + /** + * @todo Count retries and switch between server records + */ +} + +void Config::gotServerReply(SslClient::RequestType &type, QByteArray &confdata) +{ + Logger::Trace("Got server reply w type: %x\n", type); + Logger::Trace("%s\n", confdata.data()); +} + /*** * Nested class section |