diff --git a/include/downloader.h b/include/downloader.h index ab81dba..f010338 100644 --- a/include/downloader.h +++ b/include/downloader.h @@ -44,6 +44,7 @@ class Downloader Downloader(Config &conf); virtual ~Downloader(); int init(); + int login(); void listGames(); void updateCheck(); void repair(); @@ -59,7 +60,6 @@ class Downloader CURLcode downloadFile(const std::string& url, const std::string& filepath, const std::string& xml_data = std::string(), const std::string& gamename = std::string()); int repairFile(const std::string& url, const std::string& filepath, const std::string& xml_data = std::string(), const std::string& gamename = std::string()); int downloadCovers(const std::string& gamename, const std::string& directory, const std::string& cover_xml_data); - int login(); int getGameDetails(); void getGameList(); size_t getResumePosition(); diff --git a/main.cpp b/main.cpp index 490d0db..5727c3b 100644 --- a/main.cpp +++ b/main.cpp @@ -291,12 +291,12 @@ int main(int argc, char *argv[]) config.sDirectory += "/"; Downloader downloader(config); - int result = downloader.init(); + int initResult = downloader.init(); int iLoginResult = 0; - if (config.bLogin) + if (config.bLogin || initResult == 1) { - iLoginResult = result; + iLoginResult = downloader.login(); if (iLoginResult == 0) return 1; } diff --git a/src/downloader.cpp b/src/downloader.cpp index cd97f14..2939a2d 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -79,8 +79,8 @@ int Downloader::init() progressbar = new ProgressBar(config.bUnicode, config.bColor); bool bInitOK = gogAPI->init(); // Initialize the API - if (config.bLogin || !bInitOK) - return this->login(); + if (!bInitOK) + return 1; if (config.bCover && config.bDownload && !config.bUpdateCheck) coverXML = this->getResponse("https://sites.google.com/site/gogdownloader/covers.xml");