From 930c0bca2138532cdacfa39aeaaf275898b37898 Mon Sep 17 00:00:00 2001 From: Phitherek Date: Mon, 8 Apr 2013 16:02:00 +0200 Subject: [PATCH] added sleep between modinfo downloading, slowed down a bit but not DoS-ing rubenwardy' s hosting now --- ModList.cpp | 1 + OBJECTS | 3 ++- QueryAction.cpp | 23 +++++++++++++++++++++++ QueryAction.h | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 QueryAction.cpp create mode 100644 QueryAction.h diff --git a/ModList.cpp b/ModList.cpp index 86bf898..e69d61a 100644 --- a/ModList.cpp +++ b/ModList.cpp @@ -135,6 +135,7 @@ for(unsigned int i = 0; i < _modinfos.size(); i++) { ModInfo mi(_modinfos[i].getModInfoDescription()); std::cout << "Successfully downloaded and parsed: " << mi.getName() << std::endl; _modinfos[i] = mi; + sleep(2); // This is to prevent DoS-ing rubenwardy' s hosting... } catch(NetSocketPP::NetworkException &exc) { std::cerr << "NetworkException occured in NetSocket++: " << exc.what() << std::endl; } catch(NetSocketPP::SocketException &exc) { diff --git a/OBJECTS b/OBJECTS index 7c2a6f1..b59e988 100644 --- a/OBJECTS +++ b/OBJECTS @@ -10,7 +10,8 @@ ModInfoDescription: name, server, modinfoPath x ModInfo: ModInfoDescription, vector x ParameterParser: actionList, argc, argv Action: x -SyncAction +SyncAction x +QueryAction InstallAction UpdateAction RemoveAction diff --git a/QueryAction.cpp b/QueryAction.cpp new file mode 100644 index 0000000..2863f25 --- /dev/null +++ b/QueryAction.cpp @@ -0,0 +1,23 @@ +#include "QueryAction.h" +#include +#include +using namespace mmm; + +QueryAction::QueryAction(): Action() { + _local = false; +} + +QueryAction::QueryAction(bool local): Action() { + _local = local; +} + +QueryAction::~QueryAction() {} + +void QueryAction::run() { + std::cout << "Starting Query" << std::endl; + if(_local) { + + } else { + + } +} diff --git a/QueryAction.h b/QueryAction.h new file mode 100644 index 0000000..bad2439 --- /dev/null +++ b/QueryAction.h @@ -0,0 +1,32 @@ +#ifndef _QUERYACTION_H +#define _QUERYACTION_H +#include "ConfigFile.h" +#include "3mExceptions.h" +#include "ModDescription.h" +#include "LocalModDescription.h" +#include "LocalModList.h" +#include "Action.h" +#include +/// \file QueryAction.h +/// \brief A Query 3m action class. +/// \author Phitherek_ +/// \date 2013 +/// \version 0.1-pre + +/// \namespace mmm +/// \brief A global namespace for 3m. +namespace mmm { +/// \class QueryAction +/// \brief A Query 3m action class. +class QueryAction: public Action { +private: +bool _local; +public: + QueryAction(); ///< A constructor. + QueryAction(bool local); ///< \brief A constructor with parameter. + ///< \param local Indicated if to search in local repository or remote repositories. + ~QueryAction(); ///< A destructor. + void run(); ///< A virtual function that executes the action. +}; +} +#endif