#ifndef __Download_h_ #define __Download_h_ #include #include #include "../shared/MiscSupport.h" #include "../shared/SocketInfo.h" #include "../shared/Messages.h" #include "../shared/ThreadClass.h" class DownloadThread : private ThreadClass { private: enum { mtExternalRequest, mtQuit }; RequestQueue _incomingRequests; class Location { public: std::string _directory; bool _requiresLogin; Location(std::string directory = "", bool requiresLogin = false) : _directory(directory), _requiresLogin(requiresLogin) { } }; typedef std::map< std::string, Location > LocationList; LocationList _locationList; class DownloadRequest : public Request { public: std::string location; std::string file; ExternalRequest::MessageId returnMessageId; DownloadRequest(SocketInfo *socket) : Request(socket) { } }; std::string getData(DownloadRequest *request); std::string getDataFromFile(int handle, // These are only for reporting errors. std::string filename, SocketInfo *socket); protected: void threadFunction(); public: DownloadThread(); ~DownloadThread(); }; #endif